aptos-core
aptos-core copied to clipboard
[Bug] [Compiler V2] Abort wrongly typed in statements
🐛 Bug
abort
when used in statements are not typed correctly:
fun test(): u8 {
// abort(42) // this works
abort 42; // this doesn't
}
gives error
+ error: expected `u8` but found `()`
+ ┌─ tests/ability-checker/bug.move:14:11
+ │
+ │ abort 42;
+ │ ^
Interestingly, this type checks
fun test(): u8 {
if (true) {
abort 42;
};
42
}
Similar issues exist for return
.
Expected Behavior
All of the above programs should type check.
Need to check whether this is actually working in v1
What we may need is a heuristic to give error message about missing or superfluous semicolon
May be related to #11708.
Low priority for v2-stable
Confirmed that V1 behaves the same except that it generates the warning unnecessary trailing semicolon
. cc @fEst1ck @wrwg
We have already a bug for trailing semicolon, so we can close this one.