You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reporter.Error(MessageSource.Resolver, entry.Item1, "updated datatype members must belong to the same constructor " +
10492
+
"(unlike the previously mentioned destructors, '{0}' does not belong to {1})", entry.Item2, DatatypeDestructor.PrintableCtorNameList(possibleCtors, "or"));
10493
+
suppressUniquenessCheck = true;
10498
10494
}
10499
10495
}
10500
10496
}
10501
10497
}
10502
10498
10503
-
if (ctor != null) {
10499
+
if (possibleCtors.Count != 1) {
10500
+
if (!suppressUniquenessCheck) {
10501
+
var which = DatatypeDestructor.PrintableCtorNameList(possibleCtors, "and");
10502
+
string explanation;
10503
+
if (memberUpdates.Count == 1) {
10504
+
explanation = string.Format("destructor '{0}' belongs to constructors {1}", memberUpdates[0].Item2, which);
10505
+
} else {
10506
+
explanation = string.Format("the given destructors all belong to constructors {0}", which);
10507
+
}
10508
+
reporter.Error(MessageSource.Resolver, tok, "the updated datatype members must uniquely determine the resulting constructor ({0})", explanation);
10509
+
}
10510
+
} else {
10511
+
var ctor = possibleCtors[0];
10504
10512
// Rewrite an update of the form "dt[dtor := E]" to be "let d' := dt in dtCtr(E, d'.dtor2, d'.dtor3,...)"
10505
10513
// Wrapping it in a let expr avoids exponential growth in the size of the expression
10506
10514
// More generally, rewrite "E0[dtor1 := E1][dtor2 := E2]...[dtorn := En]" where "E0" is "root" to
10507
10515
// "let d' := E0 in dtCtr(...mixtures of Ek and d'.dtorj...)"
10508
10516
10517
+
// Now that we know which constructor we're talking about, we can pick out the formal corresponding to each destructor
10518
+
var fUpdates = new Dictionary<Formal, Expression>();
10519
+
foreach (var entry in updates) {
10520
+
var i = entry.Key.EnclosingCtors.IndexOf(ctor);
10521
+
Contract.Assert(0 <= i && i < entry.Key.CorrespondingFormals.Count);
Copy file name to clipboardExpand all lines: Test/allocated1/dafny0/DatatypeUpdateResolution.dfy.expect
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,5 +2,6 @@ DatatypeUpdateResolution.dfy(3,8): Error: the included file DatatypeUpdateResolu
2
2
DatatypeUpdateResolution.dfy(12,22): Error: member 'non_destructor' does not exist in datatype 'MyDataType'
3
3
DatatypeUpdateResolution.dfy(13,38): Error: member '40' does not exist in datatype 'MyDataType'
4
4
DatatypeUpdateResolution.dfy(17,61): Error: duplicate update member 'otherbool'
5
-
DatatypeUpdateResolution.dfy(19,23): Error: updated datatype members must belong to the same constructor ('otherbool' belongs to 'MyOtherConstructor' and '42' belongs to 'MyNumericConstructor'
6
-
5 resolution/type errors detected in DatatypeUpdateResolution.dfy
5
+
DatatypeUpdateResolution.dfy(19,23): Error: updated datatype members must belong to the same constructor (unlike the previously mentioned destructors, 'otherbool' does not belong to 'MyNumericConstructor')
6
+
DatatypeUpdateResolution.dfy(28,10): Error: member 'Make?' is not a destructor in datatype 'Dt'
7
+
6 resolution/type errors detected in DatatypeUpdateResolution.dfy
DatatypeUpdateResolution.dfy(12,22): Error: member 'non_destructor' does not exist in datatype 'MyDataType'
2
2
DatatypeUpdateResolution.dfy(13,38): Error: member '40' does not exist in datatype 'MyDataType'
3
3
DatatypeUpdateResolution.dfy(17,61): Error: duplicate update member 'otherbool'
4
-
DatatypeUpdateResolution.dfy(19,23): Error: updated datatype members must belong to the same constructor ('otherbool' belongs to 'MyOtherConstructor' and '42' belongs to 'MyNumericConstructor')
4
+
DatatypeUpdateResolution.dfy(19,23): Error: updated datatype members must belong to the same constructor (unlike the previously mentioned destructors, 'otherbool' does not belong to 'MyNumericConstructor')
5
5
DatatypeUpdateResolution.dfy(28,10): Error: member 'Make?' is not a destructor in datatype 'Dt'
6
6
5 resolution/type errors detected in DatatypeUpdateResolution.dfy
0 commit comments