If the struct is declared after a class and has a default creation
method, the parser will raise a "missing return type in method ..."
error.
The cause of the bug is that the global 'class_name' variable is not
updated when the parser encounters a struct, so the previous value
is used, and if a class has been parsed before, this value will be the
name of the class instead of the struct.
genie/preparser-not.gs \
genie/preparser-or-expression.gs \
genie/struct.gs \
+ genie/struct-after-class.gs \
$(NULL)
check-TESTS: $(TESTS) $(NON_NULL_TESTS)
--- /dev/null
+init
+ var a = new TestClass()
+ var b = TestStruct()
+ assert( a.empty == b.empty )
+
+class TestClass
+ empty:string = ""
+
+struct TestStruct
+ empty:string
+
+ construct()
+ empty = ""
expect (TokenType.EOL);
+ class_name = st.name;
+
parse_declarations (st);
Symbol result = st;