-
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.
TC: Allow generating a vector containing enum members
- Loading branch information
Showing
13 changed files
with
211 additions
and
72 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
A | ||
B |
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,26 @@ | ||
default Order dec | ||
|
||
$include <prelude.sail> | ||
|
||
$option --unroll-loops | ||
|
||
$[enum_vector E_members] | ||
scattered enum E | ||
|
||
enum clause E = A | ||
|
||
enum clause E = B | ||
|
||
end E | ||
|
||
val main : unit -> unit | ||
|
||
function main() = { | ||
let xs : vector(2, E) = E_members; | ||
foreach (i from 0 to 1) { | ||
match xs[i] { | ||
A => print_endline("A"), | ||
B => print_endline("B"), | ||
} | ||
} | ||
} |
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: | ||
Code generated nearby: | ||
[96mfail/enum_vector_scattered_dup.sail[0m:5.0-24: | ||
5[96m |[0m$[enum_vector E_members] | ||
[92m |[0m[92m^----------------------^[0m [92mPrevious definition[0m | ||
[96mfail/enum_vector_scattered_dup.sail[0m:12.4-34: | ||
12[96m |[0mlet E_members : vector(1, E) = [A] | ||
[91m |[0m [91m^----------------------------^[0m | ||
[91m |[0m Duplicate toplevel let binding E_members |
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 @@ | ||
default Order dec | ||
|
||
$include <prelude.sail> | ||
|
||
$[enum_vector E_members] | ||
scattered enum E | ||
|
||
enum clause E = A | ||
|
||
enum clause E = B | ||
|
||
let E_members : vector(1, E) = [A] | ||
|
||
end E |