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

Recognize type ascription / type signature distinction in compiler #11301

Open
kazcw opened this issue Oct 10, 2024 · 1 comment
Open

Recognize type ascription / type signature distinction in compiler #11301

kazcw opened this issue Oct 10, 2024 · 1 comment

Comments

@kazcw
Copy link
Contributor

kazcw commented Oct 10, 2024

Currently the compiler IR doesn't distinguish between type-signature declarations and type-ascription expressions. As a result, when translating Tree.TypeSignature and Tree.TypeAnnotated the parser's distinction between these node types is lost, and later logic analyzing the IR makes an independent determination of whether to treat the node as a declaration or expression. To ensure the compiler's behavior is consistent with the AST, we should maintain the distinction made by the parser.

I don't think they should necessarily both be IR nodes:

  • If we attach information found in type-signature declarations to the corresponding bindings as a field, we could catch more errors than the current TypeSignature validation pass; it also might be more efficient to eliminate that pass.
  • I don't know enough about how type ascriptions are used to know whether they should be a node or a field on expressions.
@kazcw
Copy link
Contributor Author

kazcw commented Oct 10, 2024

This is blocked by #11293 as currently that case is handled in the compiler instead of the parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

No branches or pull requests

2 participants