fuzion icon indicating copy to clipboard operation
fuzion copied to clipboard

lib/fuir/dfa/be: Provide features for type tests and casts, fix #967

Open fridis opened this issue 1 year ago • 0 comments

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.

fridis avatar Jul 31 '24 15:07 fridis