During generic inference, we will only infer T to be System.Any if there are no other compatible inferences. Even in cases where inferring T to be some type U with U <> System.Any whose cost is higher than inferring T to be System.Any, we would infer T = U. This prevents type inference from aggressively picking Any in too many cases.
Generic inference now considers model conversion functions, e.g. ToInterval(FHIR.Period) Interval<DateTime>, so that for functions like end of(argument Interval<T>) T, we can infer T to be System.DateTime for end of period where period is a FHIR.Period.
There are no model conversions that create lists currently, but this pattern would need to be implemented for list types also; that is not done in this PR.
Coercion cost computation now considers list and interval conversions immediately after ExactMatch analysis. The cost to coerce List<U> to List<V> is computed as the cost to coerce U to V; this same logic applies to interval point types as well.
Compatible has been split into LessCompatible and MoreCompatible, where MoreCompatible is preferential to LessCompatible. Coercions from Any to List or Interval types are considered LessCompatible than coercions to other values.
Coercion from List<U> to List<V> is now implemented through a query pattern.
List promotion and demotion now considers list "degree":
Non-list types have a degree of 0
List<T> has a degree of 1
List<List<T>> has a degree of 2
Only where the degree of the list differs by 1 can a promotion or demotion be performed. While it's possible to recursively use the query pattern to go from List<List<List<T>>> to T during a ListDemotion event, this behavior should be controlled by a currently non-existent option.
Model-defined conversion functions (e.g., in FHIRHelpers will now be considered during ImplicitConversion coercion costs, and those coercions will be implemented by creating a FunctionRef to those conversion functions.
Added multi-library support:
Definitions can now be resolved across libraries
Library providers (memory, file system) were added; more testing is needed on these
A rudimentary StreamInspector class that attempts to detect and disambiguate CQL, JSON ELM, and XML ELM was implemented to identify libraries regardless of specific file naming conventions; this would also be useful in networking use cases.
Implemented HL7 XML tests
Created a dynamic data test that reads HL7 XML test files from a test folder, compiles the expression & expectation ELM, executes, and compares the results:
1472 passed
50 skipped
Removed HL7Tests from the CoreTests project as they are now redundant.
Refinements to signature resolution:
T
to beSystem.Any
if there are no other compatible inferences. Even in cases where inferringT
to be some typeU
withU <> System.Any
whose cost is higher than inferringT
to beSystem.Any
, we would inferT = U
. This prevents type inference from aggressively pickingAny
in too many cases.ToInterval(FHIR.Period) Interval<DateTime>
, so that for functions likeend of(argument Interval<T>) T
, we can inferT
to beSystem.DateTime
forend of period
whereperiod
is aFHIR.Period
.ExactMatch
analysis. The cost to coerceList<U>
toList<V>
is computed as the cost to coerceU
toV
; this same logic applies to interval point types as well.Compatible
has been split intoLessCompatible
andMoreCompatible
, whereMoreCompatible
is preferential toLessCompatible
. Coercions fromAny
toList
orInterval
types are consideredLessCompatible
than coercions to other values.List<U>
toList<V>
is now implemented through a query pattern.List<T>
has a degree of 1List<List<T>>
has a degree of 2List<List<List<T>>>
toT
during aListDemotion
event, this behavior should be controlled by a currently non-existent option.FHIRHelpers
will now be considered duringImplicitConversion
coercion costs, and those coercions will be implemented by creating aFunctionRef
to those conversion functions.Added multi-library support:
StreamInspector
class that attempts to detect and disambiguate CQL, JSON ELM, and XML ELM was implemented to identify libraries regardless of specific file naming conventions; this would also be useful in networking use cases.Implemented HL7 XML tests
HL7Tests
from theCoreTests
project as they are now redundant.