Skip to content

Commit

Permalink
fix printing
Browse files Browse the repository at this point in the history
  • Loading branch information
riaqn committed Jan 3, 2025
1 parent 5849f26 commit 7ff35ae
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ let rec fib = function | 0 | 1 -> 1 | n -> (fib (n - 1)) + (fib (n - 2))
<def_rec>
pattern (test_locations.ml[17,534+8]..test_locations.ml[17,534+11])
Tpat_var "fib"
value_mode global,many,nonportable;join(aliased,contended)(modevar#1[aliased,uncontended .. unique,uncontended])
value_mode global,many,nonportable;unique,uncontended
expression (test_locations.ml[17,534+14]..test_locations.ml[19,572+34])
Texp_function
alloc_mode global,many,nonportable;id(modevar#7[aliased,contended .. unique,uncontended])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ let rec fib = function | 0 | 1 -> 1 | n -> (fib (n - 1)) + (fib (n - 2))
<def_rec>
pattern
Tpat_var "fib"
value_mode global,many,nonportable;join(aliased,contended)(modevar#1[aliased,uncontended .. unique,uncontended])
value_mode global,many,nonportable;unique,uncontended
expression
Texp_function
alloc_mode global,many,nonportable;id(modevar#7[aliased,contended .. unique,uncontended])
Expand Down
10 changes: 5 additions & 5 deletions testsuite/tests/parsetree/source_jane_street.ml
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,9 @@ let (~x:x0, ~s, ~(y:int), ..) : (x:int * s:string * y:int * string) =
(~x: 1, ~s: "a", ~y: 2, "ignore me")

[%%expect{|
val x0 : int @@ portable = 1
val s : string @@ portable = "a"
val y : int @@ portable = 2
val x0 : int = 1
val s : string = "a"
val y : int = 2
|}]

module M : sig
Expand Down Expand Up @@ -834,9 +834,9 @@ val foo :
('a : value_or_null) ('b : value_or_null).
'a -> (unit -> 'b) -> (unit -> 'b) -> 'b =
<fun>
val x : int @@ portable = 1
val x : int = 1
val y : int = 2
val x : int @@ portable = 1
val x : int = 1
val y : int = 2
val f : (foo:int * bar:int) -> int = <fun>
val f : (x:int * int) -> int = <fun>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/templates/basic/bad_arg_impl.reference
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ File "bad_arg_impl.ml", line 1:
Error: The argument module bad_arg_impl.ml
does not match the parameter signature monoid.cmi:
Values do not match:
val append : unit -> unit -> [> `Banana ]
val append : unit -> unit -> [> `Banana ] @@ portable
is not included in
val append : t -> t -> t
The type "unit -> unit -> [> `Banana ]" is not compatible with the type
Expand Down
12 changes: 4 additions & 8 deletions testsuite/tests/typing-modes/val_modalities.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module M = struct
let x @ contended = "hello"
end
[%%expect{|
module M : sig val x : string @@ portable contended end
module M : sig val x : string @@ contended end
|}]

(* Testing the defaulting behaviour.
Expand Down Expand Up @@ -171,8 +171,7 @@ module Without_inclusion = struct
let () = portable_use M.x
end
[%%expect{|
module Without_inclusion :
sig module M : sig val x : 'a -> 'a @@ portable end end
module Without_inclusion : sig module M : sig val x : 'a -> 'a end end
|}]

module Without_inclusion = struct
Expand Down Expand Up @@ -265,10 +264,7 @@ module Close_over_value = struct
end
[%%expect{|
module Close_over_value :
sig
module M : sig val x : string @@ portable end
val foo : unit -> unit @@ portable
end
sig module M : sig val x : string end val foo : unit -> unit end
|}]

(* CR mode-crossing: This is used for the below test in place of a mutable record. *)
Expand Down Expand Up @@ -855,7 +851,7 @@ module M_portable = struct
end
[%%expect{|
module M_nonportable : sig val f : unit -> unit end
module M_portable : sig val f : unit -> unit @@ portable end
module M_portable : sig val f : unit -> unit end
|}]

let (foo @ portable) () =
Expand Down
6 changes: 3 additions & 3 deletions testsuite/tests/typing-unique/rbtree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,10 @@ module Make_Okasaki :
val fold :
'a 'b ('c : value_or_null).
('a -> 'b -> 'c -> 'c) -> 'c -> ('a, 'b) tree -> 'c
val balance_left : ('a, 'b) tree -> ('a, 'b) tree @@ portable
val balance_right : ('a, 'b) tree -> ('a, 'b) tree @@ portable
val balance_left : ('a, 'b) tree -> ('a, 'b) tree
val balance_right : ('a, 'b) tree -> ('a, 'b) tree
val ins : Ord.t -> 'a -> (Ord.t, 'a) tree -> (Ord.t, 'a) tree
val set_black : ('a, 'b) tree -> ('a, 'b) tree @@ portable
val set_black : ('a, 'b) tree -> ('a, 'b) tree
val insert : Ord.t -> 'a -> (Ord.t, 'a) tree -> (Ord.t, 'a) tree
end
Line 110, characters 16-52:
Expand Down
2 changes: 1 addition & 1 deletion typing/printtyp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2160,7 +2160,7 @@ let tree_of_value_description id decl =
(* Important: process the fvs *after* the type; tree_of_type_scheme
resets the naming context *)
let snap = Btype.snapshot () in
let moda = Mode.Modality.Value.zap_to_floor decl.val_modalities in
let moda = Mode.Modality.Value.zap_to_id decl.val_modalities in
let qtvs = extract_qtvs [decl.val_type] in
let apparent_arity =
let rec count n typ =
Expand Down

0 comments on commit 7ff35ae

Please sign in to comment.