Summary
Defining an empty data type (a type with no constructors, analogous to Haskell's Void) and using it as an arg/return type causes an ICE in EmitCore.hs. The compiler crashes with "empty sum" error when trying to translate the type.
Minimal Reproduction
data Void;
function todo() -> Void {
assembly {
revert(0, 0)
}
}
contract C {
function main() {
todo();
}
}
↓
ERROR: empty sum Void
in: function signature function todo () -> Void
in: function todo
sol-core: Emit core failed
CallStack (from HasCallStack):
error, called at src/Solcore/Desugarer/EmitCore.hs:38:3 in sol-core-0.0.0.0-inplace:Solcore.Desugarer.EmitCore
errorsEM, called at src/Solcore/Desugarer/EmitCore.hs:214:25 in sol-core-0.0.0.0-inplace:Solcore.Desugarer.EmitCore
TODO: We also probably need to discuss the typing rule for the empty(or bottom) type.
Summary
Defining an empty data type (a type with no constructors, analogous to Haskell's
Void) and using it as an arg/return type causes an ICE inEmitCore.hs. The compiler crashes with "empty sum" error when trying to translate the type.Minimal Reproduction
↓
TODO: We also probably need to discuss the typing rule for the empty(or bottom) type.