(**** * * Test where clause instantiation, including with some nesting in component * exprs. A tricky case, e.g., is the expr "ist.e2 = [{1,2},{3,4}]" which * checks that both sides of the "=" are recognized as lists of 2-tuples. * *) obj Elem; obj Stack = e:Elem* and e2:(e2a:Elem and e2b:Elem)* and s:Size and y:Y and z:Z and x:(y:Y and z:Z); obj IntElem = i:integer; obj Size; obj Y; obj Z; obj IntStack < Stack where: Elem = IntElem; Size = integer; Y = real; Z = string; end; op t(ist: IntStack)->boolean = ( ist.s = 10; ist.e[10] = 10; ist.y = 10; ist.z = "xyz"; ist.x.y = 10; ist.x.z = "xyz"; ist.y = "xyz"; (* ERROR: .y is not a string *) ist.z = 10; (* ERROR: .z is not an int *) ist.x.y = "xyz"; (* ERROR: .x.y is not a string *) ist.x.z = 10; (* ERROR: .x.z is not an int *) ist.e.f = 10; (* ERROR: ist.e is not a tuple *) ist.s = "xyz"; (* ERROR: int.s is int, not string *) ist.e2[1].e2a.i = 10; ist.e2[1].e2a = {10,20}; (* ERROR: ist.e2[1].e2a is IntElem, not tuple*) ist.e2 = [{1,2},{3,4}]; (* FIX: Should NOT be error *) ist.e2[1].e2a.i = "xyz"; (* ERROR: ist.e2[1].e2a.i is int, not string *) ist.e2[1].e2a = "xyz"; (* ERROR: ist.e2[1].e2a is tuple, not string *) ist.e2 = [1,2]; (* ERROR: ist.e2 list of 2-tuple, not * list of int *) ist.e2[1].e2a = {10,20,30}; (* Should be ERROR but isnt in v3.2.5; * error is that ist.e2[1].e2a is 2-tuple, * not 3-tuple *) ist.e2[1].e2a = 10; ist.e2[1] = {10,20}; (* FIX: Should NOT be error *) );