forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
typing: fix a try_expand_once forgotten from ocaml#10170
On OCaml versions 5.1 and older, this caused a Ctype.Escape(_) uncaught exception on the included test case. Reported-by: Neven Villani <vanille@crans.org>
- Loading branch information
Showing
6 changed files
with
77 additions
and
1 deletion.
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
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,9 @@ | ||
module Seq : | ||
sig | ||
type 'a t = unit -> 'a node | ||
and 'a node | ||
val empty : 'a t | ||
val cons : 'a -> 'a t -> 'a t | ||
end | ||
type 'a t = T of 'a | ||
val wrong_to_seq : ('a Seq.t as 'a) Seq.t t -> 'a Seq.t Seq.t |
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,32 @@ | ||
(* TEST_BELOW *) | ||
|
||
module Seq : sig | ||
type 'a t = unit -> 'a node | ||
and 'a node | ||
|
||
val empty : 'a t | ||
val cons : 'a -> 'a t -> 'a t | ||
end = struct | ||
type 'a t = unit -> 'a node | ||
and 'a node = unit | ||
|
||
let empty () = () | ||
let cons x xs () = () | ||
end | ||
|
||
type 'a t = T of 'a | ||
|
||
(* Note: the current behavior of this function is believed to be | ||
a bug, in the sense that it creates an equi-recursive type even in | ||
absence of the -rectypes flag. On the other hand, it does not fail | ||
with the Ctype.Escape exception, as it did from 4.13 to 5.1. *) | ||
let wrong_to_seq (xt : 'a t) : 'a Seq.t = | ||
let T x = xt in | ||
Seq.cons Seq.empty x | ||
|
||
(* TEST | ||
ocamlc_flags = "-i"; | ||
setup-ocamlc.byte-build-env; | ||
ocamlc.byte; | ||
check-ocamlc.byte-output; | ||
*) |
6 changes: 6 additions & 0 deletions
6
testsuite/tests/typing-misc-bugs/pr12971_bis.compilers.reference
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,6 @@ | ||
File "pr12971_bis.ml", line 17, characters 12-48: | ||
17 | let strange x = Seq.[cons x empty; cons empty x] | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error: This expression has type "('a Seq.t as 'a) Seq.t -> 'a Seq.t Seq.t list" | ||
but an expression was expected of type | ||
"('a Seq.t as 'a) Seq.t -> 'a Seq.t Seq.t list" |
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,25 @@ | ||
(* TEST_BELOW *) | ||
|
||
module Seq : sig | ||
type 'a t = unit -> 'a node | ||
and 'a node | ||
|
||
val empty : 'a t | ||
val cons : 'a -> 'a t -> 'a t | ||
end = struct | ||
type 'a t = unit -> 'a node | ||
and 'a node = unit | ||
|
||
let empty () = () | ||
let cons x xs () = () | ||
end | ||
|
||
let strange x = Seq.[cons x empty; cons empty x] | ||
|
||
(* TEST | ||
ocamlc_byte_exit_status = "2"; | ||
ocamlc_flags = "-i"; | ||
setup-ocamlc.byte-build-env; | ||
ocamlc.byte; | ||
check-ocamlc.byte-output; | ||
*) |
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