Describe the bug
When calling GRuleEnvironment.ExecuteRule(...) with knowledge base that contains a null field and a rule that calls IsNil on this field, it prints that it panics. The recovered error message after stepping through the error shows reflect: Call using zero Value argument
To Reproduce
Steps to reproduce the behavior:
Create a DataContext and call dataCtx.AddJSON("f", someJSON) where this JSON is { "nullable": null }
Create a rule that says IsNil(f.nullable).
Pass the rule and the knowledge based based on this data context and call ExecuteRule.
Seems that this happens during CallFunction which reflect will check for the inherent type of the value. Since nil by itself is untyped, it fails the the above error.
Expected behavior
IsNil should evaluate to true.
Additional context
Add any other context about the problem here.
Same issue happened to me today. I have used the nil literal as NIL in IsNil function by typing IsNil(NIL)just for test purposes, also the Fact.STH = NIL; line also raised panic for the same reason.
Describe the bug When calling
GRuleEnvironment.ExecuteRule(...)
with knowledge base that contains a null field and a rule that callsIsNil
on this field, it prints that it panics. The recovered error message after stepping through the error showsreflect: Call using zero Value argument
To Reproduce Steps to reproduce the behavior:
dataCtx.AddJSON("f", someJSON)
where this JSON is{ "nullable": null }
IsNil(f.nullable)
.ExecuteRule
.Seems that this happens during
CallFunction
whichreflect
will check for the inherenttype
of the value. Since nil by itself is untyped, it fails the the above error.Expected behavior IsNil should evaluate to
true
.Additional context Add any other context about the problem here.