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

Annotate AST nodes with Type, not Polytype #1042

Open
byorgey opened this issue Jan 24, 2023 · 1 comment
Open

Annotate AST nodes with Type, not Polytype #1042

byorgey opened this issue Jan 24, 2023 · 1 comment
Labels
Bug The observed behaviour is incorrect or unexpected. C-Project A larger project, more suitable for experienced contributors. L-Type inference The process of inferring the type of a Swarm expression. L-Type system Issues related to the Swarm language type system. S-Moderate The fix or feature would substantially improve user experience. Z-Research This issue requires inventing something new and/or studying research papers for clues.

Comments

@byorgey
Copy link
Member

byorgey commented Jan 24, 2023

I've realized a big issue with the way this works: in particular it doesn't make sense to annotate every node of the AST with a Polytype; we should instead have a single Polytype for the entire thing at the top level, and annotate every node with a Type. For example suppose we have def wow = \x. format x ++ "!" end. The type of wow will correctly be inferred as forall a. a -> text, but if you hover over x, its type will be shown as forall a. a which does not make any sense. It should just have type a, or perhaps some made-up type variable like s0. I think I have an idea how to fix this...

Originally posted by @byorgey in #991 (comment)

@byorgey
Copy link
Member Author

byorgey commented Jan 24, 2023

Started fleshing out some ideas in branches annotate-refactor and annotate-refactor-poly.

@byorgey byorgey added Bug The observed behaviour is incorrect or unexpected. S-Moderate The fix or feature would substantially improve user experience. L-Type inference The process of inferring the type of a Swarm expression. C-Project A larger project, more suitable for experienced contributors. L-Type system Issues related to the Swarm language type system. Z-Research This issue requires inventing something new and/or studying research papers for clues. labels Nov 8, 2023
@byorgey byorgey changed the title Don't use polytypes for annotating every AST node Annotate AST nodes with Type, not Polytype Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug The observed behaviour is incorrect or unexpected. C-Project A larger project, more suitable for experienced contributors. L-Type inference The process of inferring the type of a Swarm expression. L-Type system Issues related to the Swarm language type system. S-Moderate The fix or feature would substantially improve user experience. Z-Research This issue requires inventing something new and/or studying research papers for clues.
Projects
None yet
Development

No branches or pull requests

1 participant