assemblyscript
assemblyscript copied to clipboard
fix: handle void to void during `convertExpression`
Fix: #2205
- [x] I've read the contributing guidelines
- [x] I've added my name and email to the NOTICE file
Iirc the idea of the assert is that if one converts nothing to nothing, then there isn't an expression to begin with that can be consumed as part of the conversion. Conceptionally, this would be a drop of a drop, but there's nothing to drop, so nothing to produce. As such I wonder if hitting the assertion in the first place is a sign that other code does something wrong prior?
Yeah, btw (drop (drop (...)))
is not valid operation. But it's not possible on practice due to drop has [any] -> []
signature. Or I missing something? Also on user space we can't produce explicit drops
Perhaps we should add new UNKNOWN type kind as a top type which always should be resolved at the end (or at first access). In this case we could distinguish VOID from uninit expressions better for such cases
As such I wonder if hitting the assertion in the first place is a sign that other code does something wrong prior?
@dcodeIO Because it used a un-initialized Global and throw Diagnosis before. So the this.currentType
become VOID.
@dcodeIO What is your opinion about this PR?
Tried to come up with a comment so, in case we ever run into issues here, we know what was the intention :)
Thanks!