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] Broken inline cast #5742

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

[new-parser] Broken inline cast #5742

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

Comments

@yurloc
Copy link
Contributor

yurloc commented Feb 23, 2024

Parent issue

Failing tests

  • org.drools.model.codegen.execmodel.inlinecast.InlineCastTest#testInlineCastSingle

Notes

  • Both STANDARD_FROM_DRL and PATTERN_DSL.

Rule code snippet

  $a : ICA( someB#ICB.onlyConcrete() == "Hello" )

Error output

### parse : ANTLR4_PARSER_ENABLED = true
line 2:34 no viable alternative at input 'someB#ICB.onlyConcrete('
line 2:37 mismatched input '==' expecting {'unit', 'function', 'global', 'declare', 'rule', 'query', 'when', 'then', 'end', 'and', 'or', 'exists', 'not', 'in', 'from', 'matches', 'memberOf', 'accumulate', 'acc', 'init', 'action', 'reverse', 'result', 'entry-point', 'eval', 'forall', 'over', 'salience', 'enabled', 'no-loop', 'auto-focus', 'lock-on-active', 'refract', 'direct', 'agenda-group', 'activation-group', 'ruleflow-group', 'date-effective', 'date-expires', 'dialect', 'calendars', 'timer', 'duration', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', '(', ';', '?', IDENTIFIER}
14:50:20.776 [main] ERROR o.d.d.parser.antlr4.DRLParserWrapper.parse:77 - Exception while creating PackageDescr
java.lang.IllegalStateException: ctx.lhsPattern().size() == 0 : 
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsPatternBind(DRLVisitorImpl.java:443)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsPatternBind(DRLVisitorImpl.java:74)
	at org.drools.drl.parser.antlr4.DRLParser$LhsPatternBindContext.accept(DRLParser.java:1961)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:797)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsUnary(DRLVisitorImpl.java:777)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsUnary(DRLVisitorImpl.java:74)
	at org.drools.drl.parser.antlr4.DRLParser$LhsUnaryContext.accept(DRLParser.java:1862)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
	at org.drools.drl.parser.antlr4.DRLParserBaseVisitor.visitLhsUnarySingle(DRLParserBaseVisitor.java:139)
	at org.drools.drl.parser.antlr4.DRLParser$LhsUnarySingleContext.accept(DRLParser.java:1515)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:797)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhs(DRLVisitorImpl.java:430)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitRuledef(DRLVisitorImpl.java:261)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitRuledef(DRLVisitorImpl.java:74)
	at org.drools.drl.parser.antlr4.DRLParser$RuledefContext.accept(DRLParser.java:1221)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
	at org.drools.drl.parser.antlr4.DRLParserBaseVisitor.visitDrlStatementdef(DRLParserBaseVisitor.java:27)
	at org.drools.drl.parser.antlr4.DRLParser$DrlStatementdefContext.accept(DRLParser.java:405)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:797)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitCompilationUnit(DRLVisitorImpl.java:91)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitCompilationUnit(DRLVisitorImpl.java:74)
	at org.drools.drl.parser.antlr4.DRLParser$CompilationUnitContext.accept(DRLParser.java:318)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
	at org.drools.drl.parser.antlr4.DRLParserHelper.compilationUnitContext2PackageDescr(DRLParserHelper.java:87)
	at org.drools.drl.parser.antlr4.DRLParserWrapper.parse(DRLParserWrapper.java:75)
	at org.drools.drl.parser.antlr4.DRLParserWrapper.parse(DRLParserWrapper.java:55)
	at org.drools.drl.parser.DrlParser.lambda$parse$2(DrlParser.java:189)
	at org.drools.drl.parser.DrlParser.compileWithAntlr4Parser(DrlParser.java:202)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:189)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:177)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:166)
	at org.drools.compiler.builder.impl.resources.DrlResourceHandler.process(DrlResourceHandler.java:55)
	at org.drools.compiler.builder.impl.PackageDescrBuilder.buildResource(PackageDescrBuilder.java:73)
	at org.drools.compiler.builder.impl.PackageDescrBuilder.build(PackageDescrBuilder.java:51)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackageDescr(CompositeKnowledgeBuilderImpl.java:173)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:116)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:109)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:274)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:220)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:84)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:285)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:251)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:208)
	at org.drools.model.codegen.execmodel.BaseModelTest.createKieBuilder(BaseModelTest.java:151)
	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.inlinecast.InlineCastTest.testInlineCastSingle(InlineCastTest.java:295)
14:50:20.776 [main] ERROR o.d.c.k.b.impl.AbstractKieProject.buildKnowledgePackages:280 - Unable to build KieBaseModel:defaultKieBase
[2,34]: no viable alternative at input 'someB#ICB.onlyConcrete('
[2,37]: mismatched input '==' expecting {'unit', 'function', 'global', 'declare', 'rule', 'query', 'when', 'then', 'end', 'and', 'or', 'exists', 'not', 'in', 'from', 'matches', 'memberOf', 'accumulate', 'acc', 'init', 'action', 'reverse', 'result', 'entry-point', 'eval', 'forall', 'over', 'salience', 'enabled', 'no-loop', 'auto-focus', 'lock-on-active', 'refract', 'direct', 'agenda-group', 'activation-group', 'ruleflow-group', 'date-effective', 'date-expires', 'dialect', 'calendars', 'timer', 'duration', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', '(', ';', '?', IDENTIFIER}
[0,0]: 
[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=no viable alternative at input 'someB#ICB.onlyConcrete('], Message [id=2, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=2, column=0
   text=mismatched input '==' expecting {'unit', 'function', 'global', 'declare', 'rule', 'query', 'when', 'then', 'end', 'and', 'or', 'exists', 'not', 'in', 'from', 'matches', 'memberOf', 'accumulate', 'acc', 'init', 'action', 'reverse', 'result', 'entry-point', 'eval', 'forall', 'over', 'salience', 'enabled', 'no-loop', 'auto-focus', 'lock-on-active', 'refract', 'direct', 'agenda-group', 'activation-group', 'ruleflow-group', 'date-effective', 'date-expires', 'dialect', 'calendars', 'timer', 'duration', 'module', 'open', 'requires', 'exports', 'opens', 'to', 'uses', 'provides', 'with', 'transitive', 'var', 'yield', 'record', 'sealed', 'permits', '(', ';', '?', IDENTIFIER}], Message [id=3, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=0, column=0
   text=], Message [id=4, 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.inlinecast.InlineCastTest.testInlineCastSingle(InlineCastTest.java:295)
@tkobayas
Copy link
Contributor

/take

@tkobayas
Copy link
Contributor

Fixed by #5806

@github-project-automation github-project-automation bot moved this from 📋 Backlog to 🎯 Done in 🦉 KIE Podling Board Mar 28, 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