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

Merge 5.2.0minus-5 #124

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Merge 5.2.0minus-5 #124

wants to merge 25 commits into from

Conversation

liam923
Copy link
Contributor

@liam923 liam923 commented Jan 16, 2025

Merge flambda changes for 5.2.0minus-5. The first two commits run the import script and commit merge conflicts - I recommend skipping them when reviewing.

This PR was difficult for two reasons:

  1. Unboxed types caused a lot of conflicts, and broke some Merlin code. For now, the Merlin support for unboxed types is not very good. I added a test file that demonstrates what works and what doesn't. I've internally made a ticket to improve this state of affairs.
  2. Due to overwriting, the compiler added "holes". The compiler's notion of holes is for statements like overwrite (3,4) with (_, 5). New nodes are added to the parsetree and typedtree: Pexp_hole and Texp_hole, respectively. This partially conflicts with Merlin's idea of typed holes. Before, Merlin used an extension node to represent holes in the parsetree, and in the typedtree, it also added a Texp_hole constructor. I resolve this by using the new Pexp_hole in place of an extension node (so Pexp_hole represents either type of hole) and renaming Merlin's Texp_hole to Texp_typed_hole (thus, there is now both Texp_hole and Texp_typed_hole in Merlin). I've submitted a PR to upstream Merlin to rename Texp_hole to Texp_typed_hole to mitigate conflicts in the future. (I also renamed Tmod_hole to Tmod_typed_hole for consistency - I included this in the upstream PR as well.)

@liam923 liam923 force-pushed the merge-5.2.0minus-5 branch from 14d1873 to 2678281 Compare January 16, 2025 19:36
@liam923 liam923 marked this pull request as ready for review January 16, 2025 22:26
@liam923 liam923 requested a review from goldfirere January 16, 2025 22:26
@liam923 liam923 changed the title Merge 5.2.0minus 5 Merge 5.2.0minus-5 Jan 16, 2025
@liam923
Copy link
Contributor Author

liam923 commented Jan 17, 2025

I'm a bit confused by the CI failure. The same test passes when I run locally, and I haven't yet been able to reproduce. This test has been known to be flaky in the past, so I re-ran it twice, but there's two test cases that have consistently failed across all three runs. I'm tempted to comment out those tests for now so that they don't block rolling Merlin (the justification being that they were already flaky before).

@goldfirere
Copy link
Contributor

Those tests shouldn't be flaky -- they're an output of type-checking, which should be deterministic. That said, I'm not shocked that this has changed as we've evolved the type checked. The tests are looking to see where we allocate a cell that never gets used, which is a bit unusual. I think it's fine to accept the new output. But I wouldn't comment out the tests!

@@ -240,7 +240,7 @@ Syntax errors also shouldn't escape:
"line": 1,
"col": 41
},
"type": "parser",
"type": "typer",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a good reason for this change?

:: (_, node)
:: _parents ->
let loc = Mbrowse.node_loc node_for_loc in
(loc, Construct.node ~config ~keywords ?depth ~values_scope node)
| (_, (Browse_raw.Expression { exp_desc = Texp_hole; _ } as node))
| ( _,
(Browse_raw.Expression { exp_desc = Texp_typed_hole | Texp_hole _; _ }
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this really want Texp_hole? That surprises me a bit.

let lbl = Env.find_label_by_name ident env in
let module Pack = struct
(* This gadt is used to mint the existential type [rep] *)
type t = P : 'rep Types.gen_label_description -> t
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't you use packed_label_description defined above?

| `Description lbls ->
| No -> []
| Maybe ->
Env.fold_labels Legacy add_label_description prefix_path env []
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to make a function the folds over both flavors of label? That will make it less likely to skip one flavor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants