-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parsing for vectors of literals.
This was broken in two ways: 1. with the `(LITERAL)[]` syntax, the parser would not recognize literals using type constructors 2. with the syntax `LITERAL[]`, we'd try to store the parsed value into a vector Closes #1860. (cherry picked from commit f3a0290)
- Loading branch information
Showing
4 changed files
with
26 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. | ||
[$x1=[0, 0], $x2=[1, 1], $x3=[b"abc", b"abc"]] |
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,22 @@ | ||
# @TEST-EXEC: ${SCRIPTS}/printf '\x00\x00\x01\x01abcabc' | spicy-driver -d %INPUT >output | ||
# @TEST-EXEC: btest-diff output | ||
# | ||
# @TEST-DOC: Test parsing vectors of constants; regression test for #1860. | ||
|
||
module Test; | ||
|
||
public type X = unit { | ||
x1: (uint8(0))[] foreach { | ||
assert $$ == 0: "unreachable"; | ||
} | ||
|
||
x2: uint8(1)[] foreach { | ||
assert $$ == 1: "unreachable"; | ||
} | ||
|
||
x3: b"abc"[] foreach { | ||
assert $$ == b"abc": "unreachable"; | ||
} | ||
|
||
on %done { print self; } | ||
}; |