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.
This PR refactors the new mode syntax (
@
and@@
).@
always means modes, and@@
always mean modalities. Previously,@@
can mean modes in some position for disambiguition. For example,x : a -> a @@ local
saysx
is local, andx : b -> a @ local
saysa
is local). After this PR, the first example will writex : (a -> a) @ local
. The second example doesn't change. You can also writex : a @ local
.local_ a @ portable -> b
will print backa @ local portable -> b
, whilelocal_ a -> b
prints back the same. The idea is that "if the user already knows about and uses the new mode syntax, then we should print back new mode syntax". This is done in bothpprintast.ml
andprinttyp.ml
.fun a b : ty @@ modes -> ..
was introduced by Supports mode annotation on function body #3327 , and would be changed tofun a b : ty @ modes -> ..
. Note the ambiguity: the arrow could be arrow type. We decide to remove this for simplicity.parser.mly
andpprintast.ml
, so that some missing corner cases are covered, and diff to the upstream is minimized. For example,labeled_simple_pattern
is now almost identical to upstream. This allows systematic enumeration of all possible syntax, which helps with user documentation, and test coverage.source_jane_street.ml
is rewritten to cover all possible syntax.TODO: update documentation.
Suggestions to reviewers (Not ready for review)
source_jane_street.ml
, to get a sense of the new syntax (don't look at the type errors - they are fine).parser.mly
.pprintast.ml
andprinttyp.ml
. The former should be functionally "most fine" as tested bysource_jane_street.ml
, but other aspects such as coding style should be inspected.source_jane_street.ml
, are all mechanical and can be skipped.