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

The unary type is hacky and broken #84

Open
SnirkImmington opened this issue Nov 11, 2018 · 1 comment
Open

The unary type is hacky and broken #84

SnirkImmington opened this issue Nov 11, 2018 · 1 comment
Labels
area: AST Issues which affect AST code area: build Construction of lower-level representation (i.e. LLVM modules) area: identify The "identify pass" - the ScopedId De Brujin index, or "ensure name exists in scope" area: syntax Syntactical changes to the language issue: bug Bug report priority: low Consider higher priority issues first status: blocked Cannot be done until other changes are made

Comments

@SnirkImmington
Copy link
Collaborator

SnirkImmington commented Nov 11, 2018

The issue

There are several issues which cause ICEs around the unary/void/() type. The compiler may panic in a few ways with code that attempts to use the result of a function which ends with a return void/plain return.
The only place this type can be expressed in code is as a return type of a function without a -> arrow. Consider the following definition:

fn foo()
    return
  • Assigning the result of this call to a variable, let x = foo(), causes an error in the identifier as it doesn't know the type of () for x
  • Attempting to call return foo() also errors for different reasons

Why we can't fix this

We can't represent the type of () in LLVM. Although #85 was able to fix the direct case of foo(), we want the result of this to eventually be a real unary type () in Snirk and emit LLVM code around this.

Fixing these issues is blocked on an AST representation/pass that decouples the main AST from LLVM in order to handle these cases properly on the compilation side.

@SnirkImmington SnirkImmington added area: AST Issues which affect AST code area: syntax Syntactical changes to the language area: identify The "identify pass" - the ScopedId De Brujin index, or "ensure name exists in scope" area: build Construction of lower-level representation (i.e. LLVM modules) priority: low Consider higher priority issues first status: on-hold PR contributor away or more discussion needed issue: bug Bug report labels Nov 11, 2018
@SnirkImmington SnirkImmington added status: blocked Cannot be done until other changes are made and removed status: on-hold PR contributor away or more discussion needed labels Nov 13, 2018
@SnirkImmington
Copy link
Collaborator Author

I'm reassigning this to status: blocked over on-hold given that I want to wait for a new IR, so this fix is blocked on that change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: AST Issues which affect AST code area: build Construction of lower-level representation (i.e. LLVM modules) area: identify The "identify pass" - the ScopedId De Brujin index, or "ensure name exists in scope" area: syntax Syntactical changes to the language issue: bug Bug report priority: low Consider higher priority issues first status: blocked Cannot be done until other changes are made
Projects
None yet
Development

No branches or pull requests

1 participant