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

Ensure return statement has value #12

Closed
pzipper opened this issue Jun 6, 2023 · 0 comments
Closed

Ensure return statement has value #12

pzipper opened this issue Jun 6, 2023 · 0 comments
Assignees
Labels
A-sema Area: the semantic analysis phase on the AST B-none Breaks: nothing, updates are internal and/or don't change existing features C-bug-report Category: bug report C-feature-tracking Category: tracking a planned feature which is not yet implemented M-compiler-panic Dealing with a compiler panic/crash P-high Priority: should ship in the earliest possible release
Milestone

Comments

@pzipper
Copy link
Member

pzipper commented Jun 6, 2023

The following program crashes the compiler:

const Printf = func printf(&u8): i32;

const Main = func main(): i32 {
    Printf("Hello, world!");
    return;
};
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Compilation(Verifier(VerifierErrors([VerifierError { location: inst2, context: Some("return"), message: "arguments of return must match function signature" }])))', src\clif\mod.rs:328:22

Instead, a nice diagnostic should be shown.

@pzipper pzipper added A-sema Area: the semantic analysis phase on the AST B-none Breaks: nothing, updates are internal and/or don't change existing features C-bug-report Category: bug report C-feature-tracking Category: tracking a planned feature which is not yet implemented P-high Priority: should ship in the earliest possible release M-compiler-panic Dealing with a compiler panic/crash labels Jun 6, 2023
@pzipper pzipper added this to the 0.5.0-alpha milestone Jun 6, 2023
@pzipper pzipper self-assigned this Jun 6, 2023
@pzipper pzipper closed this as completed in 8c9e58e Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sema Area: the semantic analysis phase on the AST B-none Breaks: nothing, updates are internal and/or don't change existing features C-bug-report Category: bug report C-feature-tracking Category: tracking a planned feature which is not yet implemented M-compiler-panic Dealing with a compiler panic/crash P-high Priority: should ship in the earliest possible release
Projects
None yet
Development

No branches or pull requests

1 participant