Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] [Compiler V2] Abort wrongly typed in statements #11484

Closed
fEst1ck opened this issue Dec 22, 2023 · 6 comments
Closed

[Bug] [Compiler V2] Abort wrongly typed in statements #11484

fEst1ck opened this issue Dec 22, 2023 · 6 comments
Labels
bug Something isn't working compiler-v2-stable compiler-v2 stale-exempt Prevents issues from being automatically marked and closed as stale

Comments

@fEst1ck
Copy link
Contributor

fEst1ck commented Dec 22, 2023

🐛 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.

@fEst1ck fEst1ck added bug Something isn't working compiler-v2 labels Dec 22, 2023
@sausagee sausagee added the stale-exempt Prevents issues from being automatically marked and closed as stale label Jan 9, 2024
@wrwg
Copy link
Contributor

wrwg commented Feb 15, 2024

Need to check whether this is actually working in v1

@wrwg
Copy link
Contributor

wrwg commented Feb 22, 2024

What we may need is a heuristic to give error message about missing or superfluous semicolon

@fEst1ck fEst1ck removed their assignment Feb 24, 2024
@brmataptos
Copy link
Contributor

May be related to #11708.

@wrwg
Copy link
Contributor

wrwg commented May 23, 2024

Low priority for v2-stable

@rahxephon89
Copy link
Contributor

Confirmed that V1 behaves the same except that it generates the warning unnecessary trailing semicolon. cc @fEst1ck @wrwg

@wrwg
Copy link
Contributor

wrwg commented Jun 4, 2024

We have already a bug for trailing semicolon, so we can close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler-v2-stable compiler-v2 stale-exempt Prevents issues from being automatically marked and closed as stale
Projects
Status: Done
Development

No branches or pull requests

5 participants