Describe the bug
In DSLX, calling a static method defined inside an impl block of a parametric struct from inside a parametric proc causes IR conversion (ir_converter_main / GetConversionRecords) to fail with:
Error: INTERNAL: IrConversionError: ... Failed to convert IR because type was missing for AST node: bits[N]
To Reproduce
struct Foo<N: u32> {
val: bits[N],
}
impl Foo<N> {
fn new(x: bits[N]) -> Self {
Foo<N> { val: x }
}
}
proc Bar<N: u32> {
init {
Foo<N>::new(bits[N]:0)
}
config() {
()
}
next(state: Foo<N>) {
state
}
}
proc main {
init { () }
config() {
spawn Bar<u32:32>();
}
next(state: ()) {
()
}
}
Command:
bazel run //xls/dslx/ir_convert:ir_converter_main -- /path/to/repro.x
Output:
Error: INTERNAL: IrConversionError: /path/to/repro.x:6:15-6:22 Failed to convert IR because type was missing for AST node: bits[N] (kind: type annotation)
=== Source Location Trace: ===
xls/dslx/ir_convert/function_converter.cc:113
xls/dslx/ir_convert/function_converter.cc:5482
xls/dslx/ir_convert/function_converter.cc:868
xls/dslx/ir_convert/function_converter.cc:3529
xls/dslx/ir_convert/ir_converter.cc:365
xls/dslx/ir_convert/ir_converter.cc:413
xls/dslx/ir_convert/ir_converter.cc:663
xls/dslx/ir_convert/ir_converter.cc:734
xls/dslx/ir_convert/ir_converter_main.cc:159
Expected behavior
ir_converter_main recognizes static functions in impl Foo<N> as scoped to a parametric struct, skips un-instantiated root conversion, and monomorphizes Foo<N>::new with the parametric environment from Bar<u32:32> (N=32).
Additional context
Possibly related: #2082 and #2043
Describe the bug
In DSLX, calling a static method defined inside an
implblock of a parametric struct from inside a parametric proc causes IR conversion (ir_converter_main / GetConversionRecords) to fail with:Error: INTERNAL: IrConversionError: ... Failed to convert IR because type was missing for AST node: bits[N]
To Reproduce
Command:
bazel run //xls/dslx/ir_convert:ir_converter_main -- /path/to/repro.x
Output:
Error: INTERNAL: IrConversionError: /path/to/repro.x:6:15-6:22 Failed to convert IR because type was missing for AST node: bits[N] (kind: type annotation)
=== Source Location Trace: ===
xls/dslx/ir_convert/function_converter.cc:113
xls/dslx/ir_convert/function_converter.cc:5482
xls/dslx/ir_convert/function_converter.cc:868
xls/dslx/ir_convert/function_converter.cc:3529
xls/dslx/ir_convert/ir_converter.cc:365
xls/dslx/ir_convert/ir_converter.cc:413
xls/dslx/ir_convert/ir_converter.cc:663
xls/dslx/ir_convert/ir_converter.cc:734
xls/dslx/ir_convert/ir_converter_main.cc:159
Expected behavior
ir_converter_main recognizes static functions in
impl Foo<N>as scoped to a parametric struct, skips un-instantiated root conversion, and monomorphizesFoo<N>::newwith the parametric environment fromBar<u32:32> (N=32).Additional context
Possibly related: #2082 and #2043