Layouts (Stage 2): Print inferred layout more consistently on locally-abstract types#29
Closed
ncik-roberts wants to merge 2 commits intolayouts1from
Closed
Layouts (Stage 2): Print inferred layout more consistently on locally-abstract types#29ncik-roberts wants to merge 2 commits intolayouts1from
ncik-roberts wants to merge 2 commits intolayouts1from
Conversation
68c8876 to
0239db7
Compare
e4bb8cf to
e3d77bd
Compare
0239db7 to
e759551
Compare
e3d77bd to
e212531
Compare
Signed-off-by: Nick Roberts <nroberts@janestreet.com>
Signed-off-by: Nick Roberts <nroberts@janestreet.com>
e759551 to
8d89715
Compare
Contributor
Author
|
Closing as oxcaml/oxcaml#2115 was merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix a bug where layout would be printed the first time the user queried an abstract type, but only the second time that the user queried a locally-abstract type. This is an omission in flambda-backend, so I'm posting a corresponding PR there: oxcaml/oxcaml#2115. We need not merge this merlin-jst PR; we can just wait until we pick up the flambda-backend change in the normal merge process.
Old approach that we're no longer taking (we never show layouts when the user asks for the type of a value anymore):
Previously, when you asked for the type of a value (the second time), merlin wouldn't print a type declaration if the type was abstract. E.g. asking for the type of4will only ever printint, nottype int. But this means that there isn't a sensible places to hang a layout annotation.Now, merlin always prints a type declaration for Tconstrs when you ask for the type of a value the second time.This is a bit weird for locally-abstract types, where we printtype a : immediate. We could printa : immediateinstead, but I think we should be consistent. That is, we should either:printint : immediateanda : valueprinttype int : immediateandtype a : valueI prefer the second because it's more uniform with how we handle non-abstract Tconstrs.