fuzion
fuzion copied to clipboard
lib/fuir/dfa/be: Provide features for type tests and casts, fix #967
This adds a means to test and change a type constraint to fix #967. For this, it adds one feature
Type.infix : (T type) bool
This permits code to test the type of a type parameter as in
f(x T) =>
g
pre T : String
=>
say x.codepoint_length
or
f(x T) =>
if T : String
say x.byte_count
This feature is completely evaluated at compile-timewith no code generation.