You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Compiler Bug: At this point in the compilation typechecking should not infer new types anymore, but it did." with select statement and enum types
#3333
While trying to understand the type rules for select since I would have expected serializable enums to "decay" (implict cast) into their underlaying type (but it does not and it is partly inconsistent with the rest of the specifications really) I found this issue:
Take:
enum bit<8> myenum { value = 0 }
parser MyParser1(in myenum a) {
state start {
transition select(a) {
1 .. 22: state1;
_: accept;
}
}
state state1 {
transition accept;
}
}
With p4c we get:
t.p4(8): [--Werror=type-error] error: SelectExpression
transition select(a) {
^
---- Actual error:
t.p4(1): Cannot unify type 'bit<8>' with type 'myenum'
enum bit<8> myenum
^^^^^^
---- Originating from:
t.p4(1): 'match' case label type 'bit<8>' does not match expected type 'myenum'
enum bit<8> myenum
^^^^^^
In file: /home/apinski/src/p4/p4c/frontends/p4/typeChecking/typeChecker.cpp:161
Compiler Bug: At this point in the compilation typechecking should not infer new types anymore, but it did.
Note the error message also does not point to which case lable either, it just points to the enum type but that is a different issue.
The text was updated successfully, but these errors were encountered:
While trying to understand the type rules for select since I would have expected serializable enums to "decay" (implict cast) into their underlaying type (but it does not and it is partly inconsistent with the rest of the specifications really) I found this issue:
Take:
With p4c we get:
Note the error message also does not point to which case lable either, it just points to the enum type but that is a different issue.
The text was updated successfully, but these errors were encountered: