From a0bee26d769adf61ed0a292983992a70e4e261c3 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Mon, 13 Jan 2025 16:36:11 -0800 Subject: Prevent self-inlining Better error message for self-calling functions --- .../src/test/java/com/seaofnodes/simple/Chapter18Test.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'chapter18/src/test/java/com/seaofnodes') diff --git a/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java b/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java index 0e92c8c0..1d7abde5 100644 --- a/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java +++ b/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java @@ -259,6 +259,18 @@ for(;;) { catch( Exception e ) { assertEquals("Accessing unknown field 'x' from '*S'",e.getMessage()); } } + @Test + public void testErr5() { + CodeGen code = new CodeGen( +""" +val g = { -> + g(); +}; +return 0; +"""); + try { code.parse().opto().typeCheck(); fail(); } + catch( Exception e ) { assertEquals("No defined return type",e.getMessage()); } + } // Mutual recursion. Fails without SCCP to lift the recursive return types. -- cgit v1.2.3