diff options
Diffstat (limited to 'src/test/java/com/seaofnodes/simple/MutabilityTest.java')
| -rw-r--r-- | src/test/java/com/seaofnodes/simple/MutabilityTest.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/java/com/seaofnodes/simple/MutabilityTest.java b/src/test/java/com/seaofnodes/simple/MutabilityTest.java index 3442c54a..8f99a059 100644 --- a/src/test/java/com/seaofnodes/simple/MutabilityTest.java +++ b/src/test/java/com/seaofnodes/simple/MutabilityTest.java @@ -37,6 +37,12 @@ public class MutabilityTest { bad("struct P { !P? next; int x; }; P p=new P{next=new P;}; p.next.x=7; return 0;"); } + @Test public void testInferencePreservesAccess() { + ok("struct P { int x; }; val p=new P; p.x=7; return p.x;", "7"); + bad("struct P { int x; }; val p=new P; p=new P; return 0;"); + bad("struct P { int x; }; P p=new P; var q=p; q.x=7; return 0;"); + } + @Test public void testConstructorScope() { ok("struct P { int ~x; }; P p=new P{if(arg) x=3; else x=7;}; return p.x;", "7"); bad("int ~outer=1; struct P { int x; }; P p=new P{outer=7;}; return outer;"); |
