forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error message when select types do not match (p4lang#3352)
* Improve error message when select types do not match Signed-off-by: Mihai Budiu <mbudiu@vmware.com> * Changed reference output Signed-off-by: Mihai Budiu <mbudiu@vmware.com>
- Loading branch information
1 parent
c7aacc0
commit 393f3c0
Showing
6 changed files
with
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
parser MyParser2(in bool t) { | ||
state start { | ||
transition select(t) { | ||
1w1: accept; | ||
_: reject; | ||
} | ||
} | ||
} |
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,9 @@ | ||
parser MyParser2(in bool t) { | ||
state start { | ||
transition select(t) { | ||
1w1: accept; | ||
default: reject; | ||
} | ||
} | ||
} | ||
|
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 @@ | ||
issue3345.p4(3): [--Werror=type-error] error: SelectExpression | ||
transition select(t) { | ||
^ | ||
---- Actual error: | ||
issue3345.p4(1): Cannot unify type 'bit<1>' with type 'bool' | ||
parser MyParser2(in bool t) { | ||
^^^^ | ||
---- Originating from: | ||
issue3345.p4(4): 'match' case label '1w1' has type 'bit<1>' which does not match the expected type 'bool' | ||
1w1: accept; | ||
^^^ | ||
issue3345.p4(1) | ||
parser MyParser2(in bool t) { | ||
^^^^ |