firely-cql-sdk icon indicating copy to clipboard operation
firely-cql-sdk copied to clipboard

Constructing an ELM interval with null boundaries does not work correctly

Open ewoutkramer opened this issue 5 months ago • 0 comments

Multiple tests construct an interval with a Null as boundaries, for which the type is supposed to be Interval<Any,Any>.

Our ExpressionBuilder does not handle this case well: interval construction is translated to a call to operators.Interval, but we don't have any overloads in operators that take an Any as a parameter, and the overload resolution, having nothing to go on, just picks the first overload, which happens to be Interval<CqlDate> . So, all Interval[null,null] calls turn into an Interval<CqlDate>, not Interval<Any>, which then causes typing errors.

I have introduced a fix specifically for the case where we construct an Interval where both boundaries are ELM Nulls, to return the correct typed null interval instance, but we should probably deal with this more generically, e.g. for Lists and other "generic" types.

For now, you can find the fix (and a reference to this issue) in TranslateElement, in a specific case for Interval.

ewoutkramer avatar Sep 16 '24 13:09 ewoutkramer