summaryrefslogtreecommitdiff
path: root/Test/dafny0/Compilation.dfy
diff options
context:
space:
mode:
authorGravatar leino <unknown>2014-10-23 21:52:12 -0700
committerGravatar leino <unknown>2014-10-23 21:52:12 -0700
commit40f36d68b8cb9489d052ababada29539c7d8de92 (patch)
tree46b3b65776325e0bb78b5a5bfae1d483fec0485a /Test/dafny0/Compilation.dfy
parent07ac1e4cfe6cdaf73a5bfa8b863728beae2a4c86 (diff)
Allow underscores in numeric literals (and in field/destructor names that are written as numeric strings). The
underscores have no semantic meaning, but can help a human parse the numbers.
Diffstat (limited to 'Test/dafny0/Compilation.dfy')
-rw-r--r--Test/dafny0/Compilation.dfy17
1 files changed, 17 insertions, 0 deletions
diff --git a/Test/dafny0/Compilation.dfy b/Test/dafny0/Compilation.dfy
index 2bff422f..d8ff3989 100644
--- a/Test/dafny0/Compilation.dfy
+++ b/Test/dafny0/Compilation.dfy
@@ -210,3 +210,20 @@ module GhostLetExpr {
G(5, xyz)
}
}
+
+class DigitUnderscore_Names {
+ // the following would be the same integers, but they are different fields
+ var 0_1_0: int;
+ var 010: int;
+ var 10: int;
+ // ... as we see here:
+ method M()
+ modifies this;
+ {
+ this.0_1_0 := 007;
+ this.010 := 000_008;
+ this.10 := 0x0000_0009;
+ assert this.0_1_0 == int(00_07.0_0) && this.010 == 8 && this.10 == 9;
+ this.10 := 20;
+ }
+}