Skip to content

Fix initialisation of type parameter jkinds from annotations#2840

Merged
lpw25 merged 2 commits intomainfrom
fix-decl-param-jkind-from-annotations
Aug 13, 2024
Merged

Fix initialisation of type parameter jkinds from annotations#2840
lpw25 merged 2 commits intomainfrom
fix-decl-param-jkind-from-annotations

Conversation

@jbachurski
Copy link
Copy Markdown
Contributor

@jbachurski jbachurski commented Jul 24, 2024

A simple fix for jkind assignment for type variables, which cleans up many error messages and is necessary for higher jkinds to work later down the line.

When type parameters are encountered within Typetexp.transl_type_var, their jkind is initialised anew, even when an annotation is available. This PR looks up whether a parameter of the same name had an annotation and uses that instead.
This is fine as the type variable itself is still initialised as distinct, but we know the jkinds will be consistent across all instances.

Copy link
Copy Markdown
Collaborator

@lpw25 lpw25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sound and improves a lot of error messages.

@jbachurski jbachurski force-pushed the fix-decl-param-jkind-from-annotations branch from 537ba07 to 78513c6 Compare August 12, 2024 11:07
@lpw25 lpw25 merged commit 5746147 into main Aug 13, 2024
@lpw25 lpw25 deleted the fix-decl-param-jkind-from-annotations branch August 13, 2024 09:41
ITO444 pushed a commit to ITO444/flambda-backend that referenced this pull request Aug 13, 2024
@jbachurski jbachurski restored the fix-decl-param-jkind-from-annotations branch August 27, 2024 07:23
lukemaurer pushed a commit to lukemaurer/flambda-backend that referenced this pull request Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants