-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
if
-condition with switch
parsing.
The parser generator was ignoring `if` conditions attached to `switch` constructs. While we actually had a test for this already, turns out we had recorded a broken baseline. Plus, we were testing only one variant of `switch` (expression-based, not look-ahead-based). This implements and tests both variants now. Closes #1759.
- Loading branch information
Showing
10 changed files
with
74 additions
and
19 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
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
9 changes: 7 additions & 2 deletions
9
...aseline/spicy.types.unit.switch-if/output → ...ne/spicy.types.unit.switch-if-expr/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. | ||
[$a=b"1", $b1=b"2345", $b2=(not set)] | ||
[$a=b"2", $b1=(not set), $b2=b"2345"] | ||
Mini::test { | ||
a: 1 | ||
b1: 2345 | ||
} | ||
Mini::test { | ||
a: 2 | ||
} |
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,8 @@ | ||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. | ||
Test::Foo { | ||
x1: Test::X { | ||
a: x1 | ||
} | ||
x2: Test::X {} | ||
y: Y | ||
} |
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,19 @@ | ||
# @TEST-EXEC: spicyc %INPUT -j -o %INPUT.hlto | ||
# @TEST-EXEC: echo x1Y | spicy-dump %INPUT.hlto >output | ||
# @TEST-EXEC: btest-diff output | ||
|
||
module Test; | ||
|
||
type X = unit(cond: bool) { | ||
switch { | ||
-> a: b"x1"; | ||
-> b: b"x2"; | ||
-> c: b"x3"; | ||
} if ( cond ) ; | ||
}; | ||
|
||
public type Foo = unit { | ||
x1: X(True); | ||
x2: X(False); | ||
y: b"Y"; | ||
}; |