From 8212a66ff27e56531e0b48807088f1c544d75756 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Mon, 28 Sep 2026 09:23:27 -0700 Subject: 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. --- chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'chapter10/src/test/java/com') diff --git a/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java b/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java index 527999c2..da9a4c5f 100644 --- a/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java +++ b/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java @@ -53,6 +53,7 @@ public class Chapter10Test { public void testNullGuardErrors() { for( String body : new String[] { "return p.x;", + "if (p == null) return p.x; return -1;", "if (!!point) return p.x; return -1;", "if (!!p) { int x = p.x; } return p.x;" } ) { @@ -60,7 +61,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()); } } } -- cgit v1.2.3