summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar leino <unknown>2014-12-10 05:20:22 -0800
committerGravatar leino <unknown>2014-12-10 05:20:22 -0800
commit62a3e97eb61cbee0d523297ccad1f2d3bcf871c3 (patch)
treea39cbeb674daa39fe6596e48891397e0c7920530
parent2cb39832d3acc19e48d07efd37758d005785f09d (diff)
Fixed two crashes in resolver
Corrected merge
-rw-r--r--Source/Dafny/Parser.cs2
-rw-r--r--Source/Dafny/Resolver.cs6
-rw-r--r--Test/dafny0/snapshots/runtest.snapshot.expect2
3 files changed, 6 insertions, 4 deletions
diff --git a/Source/Dafny/Parser.cs b/Source/Dafny/Parser.cs
index ed51ff17..43df66c4 100644
--- a/Source/Dafny/Parser.cs
+++ b/Source/Dafny/Parser.cs
@@ -702,7 +702,7 @@ bool IsType(ref IToken pt) {
Get();
Type(out trait);
traits.Add(trait);
- while (la.kind == 9) {
+ while (la.kind == 20) {
Get();
Type(out trait);
traits.Add(trait);
diff --git a/Source/Dafny/Resolver.cs b/Source/Dafny/Resolver.cs
index d7fb7e96..8c72d276 100644
--- a/Source/Dafny/Resolver.cs
+++ b/Source/Dafny/Resolver.cs
@@ -3912,6 +3912,7 @@ namespace Microsoft.Dafny
// nothing to resolve
} else if (type is MapType) {
var mt = (MapType)type;
+ var errorCount = ErrorCount;
int typeArgumentCount = 0;
if (mt.HasTypeArg()) {
ResolveType(tok, mt.Domain, context, option, defaultTypeArguments);
@@ -3939,11 +3940,12 @@ namespace Microsoft.Dafny
}
mt.SetRangetype(new InferredTypeProxy());
}
- if (mt.Domain.IsSubrangeType || mt.Range.IsSubrangeType) {
+ if (errorCount == ErrorCount && (mt.Domain.IsSubrangeType || mt.Range.IsSubrangeType)) {
Error(tok, "sorry, cannot instantiate collection type with a subrange type");
}
} else if (type is CollectionType) {
var t = (CollectionType)type;
+ var errorCount = ErrorCount;
if (t.HasTypeArg()) {
ResolveType(tok, t.Arg, context, option, defaultTypeArguments);
} else if (option.Opt != ResolveTypeOptionEnum.DontInfer) {
@@ -3961,7 +3963,7 @@ namespace Microsoft.Dafny
t.SetTypeArg(new InferredTypeProxy());
}
- if (t.Arg.IsSubrangeType) {
+ if (errorCount == ErrorCount && t.Arg.IsSubrangeType) {
Error(tok, "sorry, cannot instantiate collection type with a subrange type");
}
diff --git a/Test/dafny0/snapshots/runtest.snapshot.expect b/Test/dafny0/snapshots/runtest.snapshot.expect
index d62de2b1..3a0828d4 100644
--- a/Test/dafny0/snapshots/runtest.snapshot.expect
+++ b/Test/dafny0/snapshots/runtest.snapshot.expect
@@ -9,7 +9,7 @@ Dafny program verifier finished with 3 verified, 0 errors
Processing call to procedure IntraModuleCall$$_module.__default.bar in implementation Impl$$_module.__default.foo (at Snapshots0.v1.dfy(3,6)):
>>> added axiom: (forall call1old#AT#$Heap: Heap :: { ##extracted_function##1(call1old#AT#$Heap) } ##extracted_function##1(call1old#AT#$Heap) == (true && Lit(false) && (forall<alpha> $o: ref, $f: Field alpha :: { read($Heap, $o, $f) } $o != null && read(call1old#AT#$Heap, $o, alloc) ==> read($Heap, $o, $f) == read(call1old#AT#$Heap, $o, $f)) && $HeapSucc(call1old#AT#$Heap, $Heap)))
>>> added after: a##post##0 := a##post##0 && ##extracted_function##1(call1old#AT#$Heap);
-Processing command (at Snapshots0.v1.dfy(3,3)) assert (forall<alpha> $o: ref, $f: Field alpha :: false ==> $_Frame[$o, $f]);
+Processing command (at Snapshots0.v1.dfy(3,6)) assert (forall<alpha> $o: ref, $f: Field alpha :: false ==> $_Frame[$o, $f]);
>>> MarkAsFullyVerified
Processing command (at <unknown location>) a##post##0 := a##post##0 && ##extracted_function##1(call1old#AT#$Heap);
>>> AssumeNegationOfAssumptionVariable