-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for modules and scattered functions/unions
- Loading branch information
Showing
14 changed files
with
220 additions
and
0 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,9 @@ | ||
[93mType error[0m: | ||
[96mfail/private_scattered_enum.sail[0m:15.12-13: | ||
15[96m |[0menum clause E = B | ||
[91m |[0m [91m^[0m | ||
[91m |[0m Enumeration E is not in scope | ||
[91m |[0m | ||
[91m |[0m [96mfail/private_scattered_enum.sail[0m:7.23-24: | ||
[91m |[0m 7[96m |[0mprivate scattered enum E | ||
[91m |[0m [91m |[0m [91m^[0m [91mprivate definition here in A[0m |
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,17 @@ | ||
$option -dmagic_hash | ||
|
||
$project# A {} B { requires A } | ||
|
||
$start_module# A | ||
|
||
private scattered enum E | ||
|
||
enum clause E = A | ||
|
||
$end_module# | ||
|
||
$start_module# B | ||
|
||
enum clause E = B | ||
|
||
$end_module# |
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 @@ | ||
[93mType error[0m: | ||
[96mfail/private_scattered_fn.sail[0m:17.16-17: | ||
17[96m |[0mfunction clause f _ = 0 | ||
[91m |[0m [91m^[0m | ||
[91m |[0m Cannot use private definition | ||
[91m |[0m | ||
[91m |[0m [96mfail/private_scattered_fn.sail[0m:7.12-13: | ||
[91m |[0m 7[96m |[0mprivate val f : int -> int | ||
[91m |[0m [91m |[0m [91m^[0m [91mprivate definition here in A[0m |
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,19 @@ | ||
$option -dmagic_hash | ||
|
||
$project# A {} B { requires A } | ||
|
||
$start_module# A | ||
|
||
private val f : int -> int | ||
|
||
scattered function f | ||
|
||
function clause f 2 = 3 | ||
|
||
$end_module# | ||
|
||
$start_module# B | ||
|
||
function clause f _ = 0 | ||
|
||
$end_module# |
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 @@ | ||
[93mType error[0m: | ||
[96mfail/private_scattered_map.sail[0m:17.15-16: | ||
17[96m |[0mmapping clause m = 1 <-> "1" | ||
[91m |[0m [91m^[0m | ||
[91m |[0m Cannot use private definition | ||
[91m |[0m | ||
[91m |[0m [96mfail/private_scattered_map.sail[0m:7.12-13: | ||
[91m |[0m 7[96m |[0mprivate val m : int <-> string | ||
[91m |[0m [91m |[0m [91m^[0m [91mprivate definition here in A[0m |
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,19 @@ | ||
$option -dmagic_hash | ||
|
||
$project# A {} B { requires A } | ||
|
||
$start_module# A | ||
|
||
private val m : int <-> string | ||
|
||
scattered mapping m | ||
|
||
mapping clause m = 0 <-> "0" | ||
|
||
$end_module# | ||
|
||
$start_module# B | ||
|
||
mapping clause m = 1 <-> "1" | ||
|
||
$end_module# |
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 @@ | ||
[93mType error[0m: | ||
[96mfail/private_scattered_union.sail[0m:15.13-14: | ||
15[96m |[0munion clause U = B : unit | ||
[91m |[0m [91m^[0m | ||
[91m |[0m Cannot use private definition | ||
[91m |[0m | ||
[91m |[0m [96mfail/private_scattered_union.sail[0m:7.24-25: | ||
[91m |[0m 7[96m |[0mprivate scattered union U | ||
[91m |[0m [91m |[0m [91m^[0m [91mprivate definition here in A[0m |
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,17 @@ | ||
$option -dmagic_hash | ||
|
||
$project# A {} B { requires A } | ||
|
||
$start_module# A | ||
|
||
private scattered union U | ||
|
||
union clause U = A : unit | ||
|
||
$end_module# | ||
|
||
$start_module# B | ||
|
||
union clause U = B : unit | ||
|
||
$end_module# |
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,13 @@ | ||
[93mType error[0m: | ||
[96mfail/scattered_function_mod.sail[0m:23.16-17: | ||
23[96m |[0mfunction clause f _ = 0 | ||
[91m |[0m [91m^[0m | ||
[91m |[0m Not in scope | ||
[91m |[0m | ||
[91m |[0m Try requiring module A to bring the following into scope for module C: | ||
[91m |[0m [96mfail/scattered_function_mod.sail[0m:7.4-5: | ||
[91m |[0m 7[96m |[0mval f : int -> int | ||
[91m |[0m [91m |[0m [91m^[0m [91mdefinition here in A[0m | ||
[91m |[0m [96mfail/scattered_function_mod.sail[0m:3.32-33: | ||
[91m |[0m 3[96m |[0m$project# A {} B { requires A } C { requires B } | ||
[91m |[0m [91m |[0m [91m^[0m [91madd 'requires A' within C here[0m |
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 @@ | ||
$option -dmagic_hash | ||
|
||
$project# A {} B { requires A } C { requires B } | ||
|
||
$start_module# A | ||
|
||
val f : int -> int | ||
|
||
scattered function f | ||
|
||
function clause f 1 = 2 | ||
|
||
$end_module# | ||
|
||
$start_module# B | ||
|
||
function clause f 2 = 3 | ||
|
||
$end_module# | ||
|
||
$start_module# C | ||
|
||
function clause f _ = 0 | ||
|
||
$end_module# |
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,13 @@ | ||
[93mType error[0m: | ||
[96mfail/scattered_map_mod.sail[0m:23.15-16: | ||
23[96m |[0mmapping clause m = 2 <-> "2" | ||
[91m |[0m [91m^[0m | ||
[91m |[0m Not in scope | ||
[91m |[0m | ||
[91m |[0m Try requiring module A to bring the following into scope for module C: | ||
[91m |[0m [96mfail/scattered_map_mod.sail[0m:7.4-5: | ||
[91m |[0m 7[96m |[0mval m : int <-> string | ||
[91m |[0m [91m |[0m [91m^[0m [91mdefinition here in A[0m | ||
[91m |[0m [96mfail/scattered_map_mod.sail[0m:3.32-33: | ||
[91m |[0m 3[96m |[0m$project# A {} B { requires A } C { requires B } | ||
[91m |[0m [91m |[0m [91m^[0m [91madd 'requires A' within C here[0m |
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 @@ | ||
$option -dmagic_hash | ||
|
||
$project# A {} B { requires A } C { requires B } | ||
|
||
$start_module# A | ||
|
||
val m : int <-> string | ||
|
||
scattered mapping m | ||
|
||
mapping clause m = 0 <-> "0" | ||
|
||
$end_module# | ||
|
||
$start_module# B | ||
|
||
mapping clause m = 1 <-> "1" | ||
|
||
$end_module# | ||
|
||
$start_module# C | ||
|
||
mapping clause m = 2 <-> "2" | ||
|
||
$end_module# |
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,13 @@ | ||
[93mType error[0m: | ||
[96mfail/scattered_union_mod.sail[0m:21.13-14: | ||
21[96m |[0munion clause U = U3 : string | ||
[91m |[0m [91m^[0m | ||
[91m |[0m Not in scope | ||
[91m |[0m | ||
[91m |[0m Try requiring module A to bring the following into scope for module C: | ||
[91m |[0m [96mfail/scattered_union_mod.sail[0m:7.16-17: | ||
[91m |[0m 7[96m |[0mscattered union U | ||
[91m |[0m [91m |[0m [91m^[0m [91mdefinition here in A[0m | ||
[91m |[0m [96mfail/scattered_union_mod.sail[0m:3.32-33: | ||
[91m |[0m 3[96m |[0m$project# A {} B { requires A } C { requires B } | ||
[91m |[0m [91m |[0m [91m^[0m [91madd 'requires A' within C here[0m |
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,23 @@ | ||
$option -dmagic_hash | ||
|
||
$project# A {} B { requires A } C { requires B } | ||
|
||
$start_module# A | ||
|
||
scattered union U | ||
|
||
union clause U = U1 : unit | ||
|
||
$end_module# | ||
|
||
$start_module# B | ||
|
||
union clause U = U2 : int | ||
|
||
$end_module# | ||
|
||
$start_module# C | ||
|
||
union clause U = U3 : string | ||
|
||
$end_module# |