-
Notifications
You must be signed in to change notification settings - Fork 207
Backport 5.1.0-beta1 standard parser changes #2412
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
Conversation
- New `Pmod_apply_unit` module type constructor. - New `value_constraint` field in value bindings. This makes the parser less permissive about bugs in the formatting of type annotation on let-bindings. - Some changes in `Location` and `Ast_mapper` are not necessary but are backported to reduce the diff. - String assignment operator has been removed upstream but remains supported by commenting out the change.
The extended AST already had a similar constructor. This is just a rename.
Add commented-out unused code instead of removing it. This helps backporting new changes by making the code looks more similar to the upstream parser and helps to recognize added code.
We already had a similar AST node but the `value_constraint` field is new and helps removing complex code in Sugar. The `pvb_is_pun` field is kept from the previous extended representation.
instead of the extended parser (the default).
| let foo : type a' b'. a' -> b' = fun a -> assert false | ||
| let foo : type t'. t' = fun (type t') : t' -> assert false | ||
| let foo : type t. t = assert false | ||
| let foo : 't. 't = fun (type t) : t -> assert false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rewrite is no longer done.
| let x : int = x in | ||
| let (_ : int) = x in | ||
| let (_ : int) = x in | ||
| let _ : int = x in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parentheses around let-binding patterns follow the original source. These are two different AST now.
Shouldn't change existing code.
| let t2 | ||
| : 'a 'b. | ||
| 'a t________________________________ -> 'b t_______________________________________ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not consider this a regression as it's the formatting used in slightly different cases.
|
Some patterns are no longer recognized as index f2e9236473..27701537f5 100644
--- a/infer/src/pulse/PulseCallOperations.ml
+++ b/infer/src/pulse/PulseCallOperations.ml
@@ -233,8 +233,8 @@ let apply_callee tenv ({ PathContext.timestamp } as path) ~caller_proc_desc
let caller_return_var : Pvar.t =
Procdesc.get_ret_var caller_proc_desc
in
- let (astate, caller_return_val_hist)
- : AbductiveDomain.t * (AbstractValue.t * ValueHistory.t) =
+ let (astate, caller_return_val_hist) :
+ AbductiveDomain.t * (AbstractValue.t * ValueHistory.t) =
PulseOperations.eval_var path call_loc caller_return_var astate
in
let+ (astate : AbductiveDomain.t) =Some patterns were parenthesed because the expression was a index 2a34ec8b1..faaf464be 100644
--- a/testsuite/tests/typing-poly/poly.ml
+++ b/testsuite/tests/typing-poly/poly.ml
@@ -1888,11 +1888,11 @@ module Polux :
(* PR#5560 *)
-let (a, b) = (raise Exit : int * int)
+let a, b = (raise Exit : int * int)
type t = { foo : int }
-let ({ foo }) = (raise Exit : t)
+let { foo } = (raise Exit : t)
type s = A of intThis might also be an inconsistency between two code paths, though I can't pin it down yet. index 395387a93..8b7b830aa 100644
--- a/src/memo/memo.ml
+++ b/src/memo/memo.ml
@@ -1051,9 +1051,9 @@ module Exec : sig
val exec_dep_node : ('i, 'o) Dep_node.t -> 'o Fiber.t
end = struct
let rec restore_from_cache :
- 'o.
- cached_value:'o Cached_value.t ->
- 'o Cached_value.t Cache_lookup.Result.t Fiber.t =
+ 'o.
+ cached_value:'o Cached_value.t ->
+ 'o Cached_value.t Cache_lookup.Result.t Fiber.t =
fun ~cached_value ->
match cached_value.value with
| Cancelled _dependency_cycle -> |
CHANGES.md
Outdated
|
|
||
| ### New features | ||
|
|
||
| - Compatible with OCaml 5.1.0-beta1 (#2412, @Julow) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regressions are small in size and affect rare code. I would not mark this as breaking.
For consistency with the new 'value_binding'.
….26.1) CHANGES: ### Changed - Compatible with OCaml 5.1.0 (ocaml-ppx/ocamlformat#2412, @Julow) The syntax of let-bindings changed sligthly in this version. - Improved ocp-indent compatibility (ocaml-ppx/ocamlformat#2428, @Julow) - \* Removed extra break in constructor declaration with comment (ocaml-ppx/ocamlformat#2429, @Julow) - \* De-indent the `object` keyword in class types (ocaml-ppx/ocamlformat#2425, @Julow) - \* Consistent formatting of arrows in class types (ocaml-ppx/ocamlformat#2422, @Julow) ### Fixed - Fix dropped attributes on a begin-end in a match case (ocaml-ppx/ocamlformat#2421, @Julow) - Fix dropped attributes on begin-end in an if-then-else branch (ocaml-ppx/ocamlformat#2436, @gpetiot) - Fix non-stabilizing comments before a functor type argument (ocaml-ppx/ocamlformat#2420, @Julow) - Fix crash caused by module types with nested `with module` (ocaml-ppx/ocamlformat#2419, @Julow) - Fix ';;' formatting between doc-comments and toplevel directives (ocaml-ppx/ocamlformat#2432, @gpetiot)
….26.1) CHANGES: ### Changed - Compatible with OCaml 5.1.0 (ocaml-ppx/ocamlformat#2412, @Julow) The syntax of let-bindings changed sligthly in this version. - Improved ocp-indent compatibility (ocaml-ppx/ocamlformat#2428, @Julow) - \* Removed extra break in constructor declaration with comment (ocaml-ppx/ocamlformat#2429, @Julow) - \* De-indent the `object` keyword in class types (ocaml-ppx/ocamlformat#2425, @Julow) - \* Consistent formatting of arrows in class types (ocaml-ppx/ocamlformat#2422, @Julow) ### Fixed - Fix dropped attributes on a begin-end in a match case (ocaml-ppx/ocamlformat#2421, @Julow) - Fix dropped attributes on begin-end in an if-then-else branch (ocaml-ppx/ocamlformat#2436, @gpetiot) - Fix non-stabilizing comments before a functor type argument (ocaml-ppx/ocamlformat#2420, @Julow) - Fix crash caused by module types with nested `with module` (ocaml-ppx/ocamlformat#2419, @Julow) - Fix ';;' formatting between doc-comments and toplevel directives (ocaml-ppx/ocamlformat#2432, @gpetiot)
Changes that are backported:
New
Pmod_apply_unitmodule type constructor. We had a similar concept in parse-extended, so this is just a rename.New
value_constraintfield in value bindings.This makes the parser less permissive about bugs in the formatting of
type annotation on let-bindings.
Some changes in
LocationandAst_mapperare not necessary but arebackported to reduce the diff.
String assignment operator has been removed upstream but remains
supported by commenting out the change.
Dead code in parser-extended have been removed in the past. I reverted that
and commented-out the code instead. This makes the code more similar with
parser-standard and helps recognize new code.
Ast rules have changed as some constructions are no longer special.