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

Disable returning types from functions entirely #10

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

Disable returning types from functions entirely #10

pzipper opened this issue Jun 4, 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 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 4, 2023

Currently, type technically can be used as a return type for a function, but type values are not supported by the Cranelift backend.

const MyFunc = func(): type {
    return i32;
};

Which causes the compiler to output:

thread 'main' panicked at 'all possible types in Amp should be supported by Cranelift', src\clif\mod.rs:243:18

Instead, we should report a diagnostic explaining that types cannot be returned from functions.

@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 P-high Priority: should ship in the earliest possible release M-compiler-panic Dealing with a compiler panic/crash labels Jun 4, 2023
@pzipper pzipper added this to the 0.5.0-alpha milestone Jun 4, 2023
@pzipper pzipper self-assigned this Jun 4, 2023
@pzipper pzipper closed this as completed in cb43c76 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 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