xls icon indicating copy to clipboard operation
xls copied to clipboard

map w/ builtin that has a type parametric doesn't convert

Open proppy opened this issue 1 year ago • 1 comments

Describe the bug

trying to convert a map that uses a parametric builtin fails with the following error:

INTERNAL: Invalid builtin name for map: widening_cast

To Reproduce

fn f() -> u8[4] {
  map(zero!<u7[4]>(), widening_cast<u8>)
}

Related #1412

proppy avatar Oct 22 '24 23:10 proppy

I think the underlying issue here is that type parametrics (as opposed to u32) are only supported for certain builtins, and use hacks that are hard to propagate to a map call. A ParametricEnv can't even capture type parametrics, partly because an InterpValue can't be a type. widening_cast is not even supported by the bytecode interpreter, so in some contexts that would fail with a different error. The work on unifying type inference should clean this up.

richmckeever avatar Oct 23 '24 17:10 richmckeever

This no longer errors in TIv2 at build time, but as mentioned in the above comment, it still seems to fail in the bytecode interpreter at test runtime.

: internal error: UNIMPLEMENTED: BytecodeInterpreter: builtin function "widening_cast" not yet implemented.

mikex-oss avatar Sep 10 '25 21:09 mikex-oss