// RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" "%s" > "%t" // RUN: %diff "%s.expect" "%t" module M0 { class MyClass { var s: map>; static function F(w: W, w': W, t: T, u: U): int { if w == w' then 5 else 7 } function G(y: Y): Y { y } static function H(y: Y): (T, U, Y) ghost method M() { var f0 := F; var f1 := MyClass.F; var g0 := G; var x := g0(500); var g1 := G; var mc: MyClass, tt, uu, yy; if mc != null { var h0 := mc.H(5.0); tt, uu, yy := h0.0, h0.1, h0.2; if (tt, uu, yy) == MyClass.H(4.0) { } var h1 := MyClass.H(4.0); // error: types to MyClass underspecified var h2 := MyClass.H(4.0); var pt: T, pu: U; var h3 := MyClass.H(3.2); h3 := MyClass.H(3.2); pt := h3.0; pu := h3.1; var r := h3.2 + 0.3; } } } } module M1 { class C0 { function method F(x: bool, y: bool): () { () } method M0(a: int, b: int, c: int, d: int) { var u := F( a < b , (c > (d)) ); var v := F( a < b , c > d ); } method M1(a: int, b: int, c: int, d: int) { var u := F( a < b , c > (d) ); // error: undefined types b,c; undefined function a; wrong # args to F } } class C1 { function method F(x: int): () { () } function method a(x: int): int { x } method M(d: int) { var u; u := F( a < b , c > (d) ); } method P() { assert a == a; } } } module M2 { class ClassA { function F(a: A): int lemma Lem() returns (y: Y) lemma M(x: X) { var k := Lem(); } } class ClassB { lemma LemmaX(y: A) lemma LemmaY(x: int) { LemmaX(x); // error: The given type instantiation A does not agree with the type of parameter x } lemma LemmaR(x: int) lemma LemmaS() { LemmaR(5); } function FuncX(y: A): real function FuncY(x: int): real { FuncX(x) // error: The given type instantiation A does not agree with the type of parameter x } function FuncR(x: int): real function FuncS(): real { FuncR(5) } } }