summaryrefslogtreecommitdiff
path: root/Test/hofs/Twice.dfy
diff options
context:
space:
mode:
authorGravatar Rustan Leino <unknown>2015-07-02 16:06:02 -0700
committerGravatar Rustan Leino <unknown>2015-07-02 16:06:02 -0700
commite10098cde7bac9a7a1576000fa29d15f1fcd8970 (patch)
tree424cc0d382c4f870fa133c18228809da4d6a1bea /Test/hofs/Twice.dfy
parentc7f6887e452cbb91a8297bb64db39a8066750351 (diff)
Type parameters in method/function signatures are no longer auto-declared. Although
convenient and concise, the auto-declare behavior has on many occasions caused confusion when a type name has accidentally been mistyped (and Dafny had then accepted and auto-declared the name). Note, the behavior of filling in missing type parameters is still supported. This mode, although unusual (even original?) in languages, is different from the auto- declare behavior. For auto-declare, identifiers could be used in the program without having a declaration. For fill-in parameters, the implicitly declared type parameters remain anonymous.
Diffstat (limited to 'Test/hofs/Twice.dfy')
-rw-r--r--Test/hofs/Twice.dfy4
1 files changed, 2 insertions, 2 deletions
diff --git a/Test/hofs/Twice.dfy b/Test/hofs/Twice.dfy
index add7e83c..5d948a58 100644
--- a/Test/hofs/Twice.dfy
+++ b/Test/hofs/Twice.dfy
@@ -1,7 +1,7 @@
// RUN: %dafny /print:"%t.print" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
-function method Twice(f : A -> A): A -> A
+function method Twice<A>(f : A -> A): A -> A
{
x requires f.requires(x) && f.requires(f(x))
reads f.reads(x) reads if f.requires(x) then f.reads(f(x)) else {}
@@ -29,7 +29,7 @@ method WithReads() {
}
-function method Twice_bad(f : A -> A): A -> A
+function method Twice_bad<A>(f : A -> A): A -> A
{
x requires f.requires(x) && f.requires(f(x))
reads f.reads(x) + f.reads(f(x))