-
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 basic mapdef completeness check, converting mpat to pat, then to gpat, and finally reusing the match checking logic
- Loading branch information
trdthg
committed
Jul 27, 2024
1 parent
09ac4b2
commit 5fb2a22
Showing
11 changed files
with
181 additions
and
5 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
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,10 @@ | ||
struct bool2 = { | ||
field: bool, | ||
} | ||
|
||
mapping m : bool <-> bool2 = { | ||
true <-> struct { field = true }, | ||
false <-> struct{ field = false }, | ||
} | ||
|
||
let a = m(true) |
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 @@ | ||
[93mWarning[0m: Incomplete pattern match statement at [96mwarn_mapping.sail[0m:15.0-5: | ||
15[96m |[0mmapping bool_rev3 : bool <-> bool2 = { | ||
[91m |[0m[91m^---^[0m | ||
[91m |[0m | ||
The following expression is unmatched: [93mstruct { field = false }[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,18 @@ | ||
struct bool2 = { | ||
field: bool, | ||
} | ||
|
||
mapping bool_rev : bool <-> bool2 = { | ||
true <-> struct { field = true }, | ||
false <-> struct{ field = false }, | ||
} | ||
|
||
mapping bool_rev2 : bool <-> bool2 = { | ||
true <-> struct { field = false }, | ||
false <-> struct{ field = true }, | ||
} | ||
|
||
mapping bool_rev3 : bool <-> bool2 = { | ||
true <-> struct { field = true }, | ||
false <-> struct{ field = true }, | ||
} |
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 @@ | ||
[93mWarning[0m: Incomplete pattern match statement at [96mwarn_mapping_l.sail[0m:1.0-5: | ||
1[96m |[0mmapping m : bool <-> int = { | ||
[91m |[0m[91m^---^[0m | ||
[91m |[0m | ||
The following expression is unmatched: [93mfalse[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,3 @@ | ||
mapping m : bool <-> int = { | ||
forwards true => 1, | ||
} |
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,12 @@ | ||
[93mWarning[0m: Deprecated [96mwarn_mapping_r.sail[0m:2.3-12: | ||
2[96m |[0m true => 1, | ||
[91m |[0m [91m^-------^[0m | ||
[91m |[0m | ||
Single direction mapping clause should be prefixed by a direction, either forwards or backwards | ||
|
||
[93mWarning[0m: Incomplete pattern match statement at [96mwarn_mapping_r.sail[0m:1.0-5: | ||
1[96m |[0mmapping m : bool <-> int = { | ||
[91m |[0m[91m^---^[0m | ||
[91m |[0m | ||
The following expression is unmatched: [93mfalse[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,4 @@ | ||
mapping m : bool <-> int = { | ||
true => 1, | ||
backwards 2 => false, | ||
} |