Closed esdrubal closed 1 year ago
Do you know if this is a frontend or codegen issue?
I've seen IR gen happily insert undef
before instead of asserting, when given IR that is not fully correctly typed.
Just something to keep in mind.
This looks like a frontend bug that the backend could catch.
Here is the line of code that is adding the undef
, I tried to replace it by a compile error but it is required as it says on the comments for diverging control flow and implicit returns.
https://github.com/FuelLabs/sway/blob/0d45b890c9eaa75b88093a9a4cbecbf5ca8c0731/sway-core/src/ir_generation/compile.rs#L491-L496
The following script should not fail on the assert.
In the generated IR we can see that
call_trait_7
is returning undef:We should make sure that the compiler no longer fails silently while compiling generic methods.