-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flambda-backend: Check that layout variables aren't unconstrained whe…
…n writing `cmi`s (#1474) * Working implementation of check * Fix bug where GADT constructors of extensible variant decls weren't getting defaulted * Cleanup: rename and comment things; CR places of confusion * Flatten a variant created in the hot path * Use global ref instead of passing [loc] through the hot path of [typexp] * Respond to review comments
- Loading branch information
1 parent
284889c
commit 4b2e620
Showing
12 changed files
with
333 additions
and
117 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
testsuite/tests/typing-layouts-gadt-sort-var/extract_extensible.ml
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 @@ | ||
(* Disable warning 8 as it's unrelated to this test: It's the inexhaustive | ||
match warning when you don't have a wildcard case for extensible variants. | ||
*) | ||
let[@ocaml.warning "-8"] f (Gadt_extensible.Mk (produce, consume)) = | ||
let (surely_is_a_value, _) = (produce (), 5) in | ||
consume surely_is_a_value |
4 changes: 4 additions & 0 deletions
4
testsuite/tests/typing-layouts-gadt-sort-var/gadt_extensible.ml
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,4 @@ | ||
type t_ext = .. | ||
|
||
type t_ext += | ||
| Mk : (unit -> 'a) * ('a -> unit) -> t_ext |
5 changes: 5 additions & 0 deletions
5
testsuite/tests/typing-layouts-gadt-sort-var/insert_extensible.ml
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,5 @@ | ||
type t_void [@@void] | ||
|
||
let rec g (_ : t_void) = () | ||
|
||
and packed = Gadt_extensible.Mk ((fun _ -> assert false), g) |
6 changes: 6 additions & 0 deletions
6
testsuite/tests/typing-layouts-gadt-sort-var/test_extensible.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 "insert_extensible.ml", line 5, characters 58-59: | ||
5 | and packed = Gadt_extensible.Mk ((fun _ -> assert false), g) | ||
^ | ||
Error: This expression has type t_void -> unit | ||
but an expression was expected of type 'a -> unit | ||
t_void has layout void, which is not a sublayout of value. |
14 changes: 14 additions & 0 deletions
14
testsuite/tests/typing-layouts-gadt-sort-var/test_extensible.ml
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,14 @@ | ||
(* TEST | ||
readonly_files = "gadt_extensible.ml insert_extensible.ml extract_extensible.ml" | ||
flags = "-extension layouts_alpha" | ||
* setup-ocamlc.byte-build-env | ||
** ocamlc.byte | ||
module = "gadt_extensible.ml" | ||
*** ocamlc.byte | ||
module = "extract_extensible.ml" | ||
**** ocamlc.byte | ||
module = "insert_extensible.ml" | ||
ocamlc_byte_exit_status = "2" | ||
***** 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
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
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
Oops, something went wrong.