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.
Recognize unrecoverable errors in Includemod
Stop the computation of a signature difference when the types start to diverge in order to avoid trying to typecheck items in incoherent environments. See ocaml#10836
- Loading branch information
Showing
4 changed files
with
80 additions
and
9 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
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,34 @@ | ||
(* TEST | ||
* expect | ||
*) | ||
|
||
(** The aim of this file is to keep track of programs that are "far" from being well-typed *) | ||
|
||
|
||
(** Arity mismatch between structure and signature *) | ||
|
||
module M : sig | ||
type (_, _) t | ||
val f : (_, _) t -> unit | ||
end = struct | ||
type _ t | ||
let f _ = () | ||
end | ||
|
||
[%%expect{| | ||
Lines 9-12, characters 6-3: | ||
9 | ......struct | ||
10 | type _ t | ||
11 | let f _ = () | ||
12 | end | ||
Error: Signature mismatch: | ||
Modules do not match: | ||
sig type _ t val f : 'a -> unit end | ||
is not included in | ||
sig type (_, _) t val f : ('a, 'b) t -> unit end | ||
Type declarations do not match: | ||
type _ t | ||
is not included in | ||
type (_, _) t | ||
They have different arities. | ||
|}] |
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