You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
It seems you can cast scalar values to their own types, but XLS will error out with an unhelpful error message if you try to do the same with arrays.
Error: INTERNAL: XLS_RET_CHECK failure (xls/dslx/diagnostics/format_type_mismatch.cc:250) !data.mismatches.empty() FormatTypeMismatch; type mismatch info not constructed correctly for types array vs. array -- we got no mismatches when zip...
=== Source Location Trace: ===
xls/common/status/status_builder.cc:197
xls/dslx/diagnostics/format_type_mismatch.cc:250
xls/dslx/diagnostics/maybe_explain_error.cc:42
xls/dslx/parse_and_typecheck.cc:102
xls/dslx/interpreter_main.cc:198
__main__.XlsRuntimeError('Error: INTERNAL: XLS_RET_CHECK failure (xls/dslx/diagnostics/format_type_mismatch.cc:250) !data.mismatches.empty() FormatTypeMismatch; type mismatch info not constructed correctly for types array vs. array -- we got no mismatches when zipping the types; lhs: uN[32][4] rhs: uN[32][4]\n=== Source Location Trace: ===\nxls/common/status/status_builder.cc:197\nxls/dslx/diagnostics/format_type_mismatch.cc:250\nxls/dslx/diagnostics/maybe_explain_error.cc:42\nxls/dslx/parse_and_typecheck.cc:102\nxls/dslx/interpreter_main.cc:198\n')
To Reproduce
Steps to reproduce the behavior:
Compile the following DSLX code:
fn foo() {
let x = u32:1;
let _y = x as u32; // OK
let indices = u32[4]:[0, 1, 3, 4];
const DATA_W = u32:32;
let _data = indices as uN[DATA_W][4]; // Error
}
Expected behavior
If you try to do the same with a different size element bitwidth, you get a more reasonable error:
0011: let indices = u32[4]:[0, 1, 3, 4];
0012: const DATA_W = u32:64;
0013: let _data = indices as uN[DATA_W][4];
~~~~~~~~~~~~~~~~~~~~^----------------------^ XlsTypeError: Cannot cast from expression type uN[32][4] to uN[64][4].
Type mismatch:
uN[32][4]
vs uN[64][4]
Side note: this syntax would be useful to avoid a for loop (#1671), at least until (perhaps even with?) map with lambdas (#1542).
The text was updated successfully, but these errors were encountered:
Note that the internal error is just flagging that a type error was created with identical types (so it probably shouldn't have been a type mismatch error, as your OP points out)
Describe the bug
It seems you can cast scalar values to their own types, but XLS will error out with an unhelpful error message if you try to do the same with arrays.
To Reproduce
Steps to reproduce the behavior:
Compile the following DSLX code:
Expected behavior
If you try to do the same with a different size element bitwidth, you get a more reasonable error:
Side note: this syntax would be useful to avoid a for loop (#1671), at least until (perhaps even with?) map with lambdas (#1542).
The text was updated successfully, but these errors were encountered: