summaryrefslogtreecommitdiff
path: root/Source
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 /Source
parent2cb39832d3acc19e48d07efd37758d005785f09d (diff)
Fixed two crashes in resolver
Corrected merge
Diffstat (limited to 'Source')
-rw-r--r--Source/Dafny/Parser.cs2
-rw-r--r--Source/Dafny/Resolver.cs6
2 files changed, 5 insertions, 3 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");
}