-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resurrect half of the Bad_fixed_type error
but make the error message much more explicit about what is happening.
- Loading branch information
Showing
3 changed files
with
76 additions
and
4 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,52 @@ | ||
(* TEST | ||
* expect | ||
*) | ||
|
||
(** Error message for trying to make private a row type variable | ||
that only exists syntactically *) | ||
|
||
type a = [`A | `C | `D] | ||
type b = [`B | `D | `E] | ||
type c = private [< a | b > `A `B `C `D `E] | ||
[%%expect {| | ||
type a = [ `A | `C | `D ] | ||
type b = [ `B | `D | `E ] | ||
Line 6, characters 0-43: | ||
6 | type c = private [< a | b > `A `B `C `D `E] | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error: This private row type declaration is invalid. | ||
The type expression on the right-hand side reduces to | ||
[ `A | `B | `C | `D | `E ] | ||
which does not have a free row type variable. | ||
Hint: If you intended to define a private type abbreviation, | ||
write explicitly | ||
private [ `A | `B | `C | `D | `E ] | ||
|}] | ||
|
||
type u = private < x:int; .. > as 'a constraint 'a = < x: int > ;; | ||
[%%expect {| | ||
Line 1, characters 0-63: | ||
1 | type u = private < x:int; .. > as 'a constraint 'a = < x: int > ;; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error: This private row type declaration is invalid. | ||
The type expression on the right-hand side reduces to | ||
< x : int > | ||
which does not have a free row type variable. | ||
Hint: If you intended to define a private type abbreviation, | ||
write explicitly | ||
private < x : int > | ||
|}] | ||
|
||
type u = private [> `A ] as 'a constraint 'a = [< `A ] ;; | ||
[%%expect {| | ||
Line 1, characters 0-54: | ||
1 | type u = private [> `A ] as 'a constraint 'a = [< `A ] ;; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error: This private row type declaration is invalid. | ||
The type expression on the right-hand side reduces to | ||
[ `A ] | ||
which does not have a free row type variable. | ||
Hint: If you intended to define a private type abbreviation, | ||
write explicitly | ||
private [ `A ] | ||
|}] |
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
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