[ICE] Empty data type causes `EmitCore` crash
- Dominant language
- Haskell
- Stars
- 113
- Forks
- 9
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 1
Description
## 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
```solidity
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.