Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[new-parser] function definition causes an error #5708

Closed
yurloc opened this issue Feb 20, 2024 · 2 comments
Closed

[new-parser] function definition causes an error #5708

yurloc opened this issue Feb 20, 2024 · 2 comments
Assignees

Comments

@yurloc
Copy link
Contributor

yurloc commented Feb 20, 2024

Parent issue

Failing tests

  • org.drools.model.codegen.execmodel.MvelOperatorsTest#testMatchesWithFunction

Notes

  • Both STANDARD_FROM_DRL and PATTERN_DSL.

Rule code snippet

function String addStar(String s) { return s + "*"; }

Error output

### parse : ANTLR4_PARSER_ENABLED = true
line 2:45 missing ';' at '+'
line 2:47 mismatched input '"*"' expecting {'boolean', 'byte', 'char', 'double', 'float', 'int', 'long', 'new', 'short', 'super', 'switch', 'this', 'void', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', DECIMAL_LITERAL, HEX_LITERAL, OCT_LITERAL, BINARY_LITERAL, FLOAT_LITERAL, HEX_FLOAT_LITERAL, BOOL_LITERAL, CHAR_LITERAL, STRING_LITERAL, TEXT_BLOCK, 'null', '(', '<', '!', '~', '++', '--', '+', '-', '@', IDENTIFIER}
21:45:05.199 [main] ERROR o.d.c.k.b.impl.AbstractKieProject.buildKnowledgePackages:280 - Unable to build KieBaseModel:defaultKieBase
[2,45]: missing ';' at '+'
[2,47]: mismatched input '"*"' expecting {'boolean', 'byte', 'char', 'double', 'float', 'int', 'long', 'new', 'short', 'super', 'switch', 'this', 'void', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', DECIMAL_LITERAL, HEX_LITERAL, OCT_LITERAL, BINARY_LITERAL, FLOAT_LITERAL, HEX_FLOAT_LITERAL, BOOL_LITERAL, CHAR_LITERAL, STRING_LITERAL, TEXT_BLOCK, 'null', '(', '<', '!', '~', '++', '--', '+', '-', '@', IDENTIFIER}
[0,0]: Parser returned a null Package


java.lang.AssertionError: [Message [id=1, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=2, column=0
   text=missing ';' at '+'], Message [id=2, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=2, column=0
   text=mismatched input '"*"' expecting {'boolean', 'byte', 'char', 'double', 'float', 'int', 'long', 'new', 'short', 'super', 'switch', 'this', 'void', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', DECIMAL_LITERAL, HEX_LITERAL, OCT_LITERAL, BINARY_LITERAL, FLOAT_LITERAL, HEX_FLOAT_LITERAL, BOOL_LITERAL, CHAR_LITERAL, STRING_LITERAL, TEXT_BLOCK, 'null', '(', '<', '!', '~', '++', '--', '+', '-', '@', IDENTIFIER}], Message [id=3, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=0, column=0
   text=Parser returned a null Package]]

	at org.drools.model.codegen.execmodel.BaseModelTest.createKieBuilder(BaseModelTest.java:157)
	at org.drools.model.codegen.execmodel.BaseModelTest.createKieBuilder(BaseModelTest.java:132)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieContainer(BaseModelTest.java:121)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieContainer(BaseModelTest.java:114)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieSession(BaseModelTest.java:110)
	at org.drools.model.codegen.execmodel.BaseModelTest.getKieSession(BaseModelTest.java:106)
	at org.drools.model.codegen.execmodel.MvelOperatorsTest.testMatchesWithFunction(MvelOperatorsTest.java:327)
@tkobayas
Copy link
Contributor

/take

@tkobayas
Copy link
Contributor

Fixed by #5793

@github-project-automation github-project-automation bot moved this from 📋 Backlog to 🎯 Done in 🦉 KIE Podling Board Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants