diff options
| author | Cliff Click <cliffc@acm.org> | 2026-09-28 09:23:27 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-09-28 09:23:27 -0700 |
| commit | 8212a66ff27e56531e0b48807088f1c544d75756 (patch) | |
| tree | d1a1cdbf1ae790ddd8378714d4325a84b90bfc17 /chapter15/src/test/java | |
| parent | 3d226b49e1cd23b41fd9baf3917f751973c1ad11 (diff) | |
| download | Simple-8212a66ff27e56531e0b48807088f1c544d75756.tar.gz Simple-8212a66ff27e56531e0b48807088f1c544d75756.zip | |
Check un-init not-null constructor fields
Propagate BOT inputs; Arith, Load.
CallEnd inlining, the FUnPtr dies early.
Load asserts when loading against uninit not-null field.
Keep not-nill state for storage class.
Clean up Node.peep as constant.
Diffstat (limited to 'chapter15/src/test/java')
| -rw-r--r-- | chapter15/src/test/java/com/seaofnodes/simple/Chapter10Test.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/chapter15/src/test/java/com/seaofnodes/simple/Chapter10Test.java b/chapter15/src/test/java/com/seaofnodes/simple/Chapter10Test.java index 589ae97f..bd56a944 100644 --- a/chapter15/src/test/java/com/seaofnodes/simple/Chapter10Test.java +++ b/chapter15/src/test/java/com/seaofnodes/simple/Chapter10Test.java @@ -49,6 +49,7 @@ public class Chapter10Test { public void testNullGuardErrors() { for( String body : new String[] { "return p.x;", + "if (p == null) return p.x; return -1;", "if (!!points) return p.x; return -1;", "if (!!p) { int x = p.x; } return p.x;" } ) { @@ -56,7 +57,10 @@ public class Chapter10Test { new Parser(NULLABLE_POINT_SOURCE+body).parse().iterate(); fail(body); } catch( RuntimeException e ) { - assertEquals(body,"Might be null accessing 'x'",e.getMessage()); + // Known null is rejected during parsing in these chapters. + String expected = body.startsWith("if (p == null)") + ? "Accessing unknown field 'x' from 'null'" : "Might be null accessing 'x'"; + assertEquals(body,expected,e.getMessage()); } } } |
