-
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.
Merge pull request #11396 from gasche/fix11392
Fix 11392 (assertion failure on external with -rectypes) (cherry picked from commit 724cefb)
- Loading branch information
Showing
3 changed files
with
38 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,34 @@ | ||
(* TEST | ||
* expect | ||
*) | ||
|
||
type 'self nat = | ||
| Z | ||
| S of 'self | ||
;; | ||
[%%expect{| | ||
type 'self nat = Z | S of 'self | ||
|}] | ||
|
||
|
||
|
||
(* without rectypes: rejected *) | ||
external cast : int -> 'self nat as 'self = "%identity" | ||
;; | ||
[%%expect{| | ||
Line 1, characters 16-41: | ||
1 | external cast : int -> 'self nat as 'self = "%identity" | ||
^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error: This alias is bound to type int -> 'a nat | ||
but is used as an instance of type 'a | ||
The type variable 'a occurs inside int -> 'a nat | ||
|}] | ||
|
||
#rectypes;; | ||
|
||
(* with rectypes: accepted (used to crash) *) | ||
external cast : int -> 'self nat as 'self = "%identity" | ||
;; | ||
[%%expect{| | ||
external cast : int -> 'a nat as 'a = "%identity" | ||
|}] |
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