-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flambda-backend: Protect calling not_nolabel_function, just as it use…
…d to be (#2425)
- Loading branch information
1 parent
bc2db04
commit 0d9efda
Showing
2 changed files
with
77 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
(* TEST | ||
* expect | ||
*) | ||
|
||
(* A bug in typecore leading to extra expansion led this to be rejected. *) | ||
|
||
type (_, _) refl = Refl : ('a, 'a) refl | ||
|
||
[%%expect{| | ||
type (_, _) refl = Refl : ('a, 'a) refl | ||
|}] | ||
|
||
let apply (_ : unit -> 'a) : 'a = assert false | ||
let go (type a) (Refl : (unit, a) refl) = apply (fun () : a -> ()) | ||
|
||
[%%expect{| | ||
val apply : (unit -> 'a) -> 'a = <fun> | ||
val go : (unit, 'a) refl -> 'a = <fun> | ||
|}] | ||
|
||
let apply (_ : x:unit -> unit -> 'a) : 'a = assert false | ||
let go (type a) (Refl : (unit, a) refl) = apply (fun ~x:_ () : a -> ()) | ||
|
||
[%%expect{| | ||
val apply : (x:unit -> unit -> 'a) -> 'a = <fun> | ||
val go : (unit, 'a) refl -> 'a = <fun> | ||
|}] | ||
|
||
let apply (_ : ?x:unit -> unit -> 'a) : 'a = assert false | ||
let go (type a) (Refl : (unit, a) refl) = apply (fun ?x:_ () : a -> ()) | ||
|
||
[%%expect{| | ||
val apply : (?x:unit -> unit -> 'a) -> 'a = <fun> | ||
Line 2, characters 42-71: | ||
2 | let go (type a) (Refl : (unit, a) refl) = apply (fun ?x:_ () : a -> ()) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error: This expression has type a = unit | ||
but an expression was expected of type 'a | ||
This instance of unit is ambiguous: | ||
it would escape the scope of its equation | ||
|}] | ||
|
||
let apply (_ : unit -> x:unit -> 'a) : 'a = assert false | ||
let go (type a) (Refl : (unit, a) refl) = apply (fun () ~x:_ : a -> ()) | ||
|
||
[%%expect{| | ||
val apply : (unit -> x:unit -> 'a) -> 'a = <fun> | ||
val go : (unit, 'a) refl -> 'a = <fun> | ||
|}] | ||
|
||
let apply (_ : unit -> ?x:unit -> 'a) : 'a = assert false | ||
let go (type a) (Refl : (unit, a) refl) = apply (fun () ?x:_ : a -> ()) | ||
|
||
[%%expect{| | ||
val apply : (unit -> ?x:unit -> 'a) -> 'a = <fun> | ||
Line 2, characters 59-60: | ||
2 | let go (type a) (Refl : (unit, a) refl) = apply (fun () ?x:_ : a -> ()) | ||
^ | ||
Warning 16 [unerasable-optional-argument]: this optional argument cannot be erased. | ||
|
||
Line 2, characters 42-71: | ||
2 | let go (type a) (Refl : (unit, a) refl) = apply (fun () ?x:_ : a -> ()) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error: This expression has type a = unit | ||
but an expression was expected of type 'a | ||
This instance of unit is ambiguous: | ||
it would escape the scope of its equation | ||
|}] |
This file contains 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