diff options
| author | Cliff Click <cliffc@acm.org> | 2026-08-10 11:11:18 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-11-08 14:10:02 -0800 |
| commit | 44505aa5b75b1046f13f2bc2a52fe0b16d975838 (patch) | |
| tree | cc558485c807ac3842cd73943cf5e294c4a307de /src/test/java/com/seaofnodes/simple/PartialReadTest.java | |
| parent | 2560096fb4636263798ae56c88687973c72cdf6e (diff) | |
| download | Simple-linear-chapter30.tar.gz Simple-linear-chapter30.zip | |
Chapter 30: Text Formatting and Diagnosticslinear-chapter30
Co-authored-by: Hsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com>
Co-authored-by: fuhsnn <66062782+fuhsnn@users.noreply.github.com>
Co-authored-by: Symious <14933944+symious@users.noreply.github.com>
Co-authored-by: Jun Kawasaki <jun784@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/test/java/com/seaofnodes/simple/PartialReadTest.java')
| -rw-r--r-- | src/test/java/com/seaofnodes/simple/PartialReadTest.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/java/com/seaofnodes/simple/PartialReadTest.java b/src/test/java/com/seaofnodes/simple/PartialReadTest.java index a6230b69..427096e5 100644 --- a/src/test/java/com/seaofnodes/simple/PartialReadTest.java +++ b/src/test/java/com/seaofnodes/simple/PartialReadTest.java @@ -11,7 +11,7 @@ public class PartialReadTest { private static String program(String body, String helper) { return "struct _C { int~ x; int~ y; new _C = { int n -> " + body + " }; }; val _read_noInline = { _C ^p -> " + helper + - " }; return new _C(arg).y;"; + " }; return new _C(((arg<<32)>>32)).y;"; } private static void rejects(String source, String message) { try { @@ -108,7 +108,7 @@ public class PartialReadTest { _Child child; new _Parent = { int n -> x=n; child=new _Child(self); }; }; - val p=new _Parent(arg); return p.child.seen+p.child.parent.x; + val p=new _Parent(((arg<<32)>>32)); return p.child.seen+p.child.parent.x; """; assertEquals("22",Eval2.eval(new CodeGen(src).driver(CodeGen.Phase.TypeCheck),11)); rejects(src.replace("x=n; child=new _Child(self);","child=new _Child(self); x=n;"),"might not be initialized"); @@ -127,7 +127,7 @@ public class PartialReadTest { new _C = { int n -> data=new int[1]; data[0]=n; y=_read_noInline(self); }; }; val _read_noInline={ _C ^p -> return p.data[0]; }; - return new _C(arg).y; + return new _C(((arg<<32)>>32)).y; """; assertEquals("23",Eval2.eval(new CodeGen(src).driver(CodeGen.Phase.TypeCheck),23)); // A set reference slot is not proof that its referent is initialized. |
