diff --git a/frontends/p4/typeChecking/typeChecker.cpp b/frontends/p4/typeChecking/typeChecker.cpp index 7b2b6864ecc..00d8331df20 100644 --- a/frontends/p4/typeChecking/typeChecker.cpp +++ b/frontends/p4/typeChecking/typeChecker.cpp @@ -1021,21 +1021,6 @@ TypeInference::checkExternConstructor(const IR::Node* errorPosition, if (!functionType->is()) BUG("Unexpected type for function %1%", functionType); - LOG2("Constructor type before specialization " << methodType << " with " << tvs); - TypeVariableSubstitutionVisitor substVisitor(tvs); - substVisitor.setCalledBy(this); - auto specMethodType = methodType->apply(substVisitor); - LOG2("Constructor type after specialization " << specMethodType); - learn(specMethodType, this); - auto canon = getType(specMethodType); - if (canon == nullptr) - return nullptr; - - auto functionType = specMethodType->to(); - BUG_CHECK(functionType != nullptr, "Method type is %1%", specMethodType); - if (!functionType->is()) - BUG("Unexpected type for function %1%", functionType); - ConstantTypeSubstitution cts(tvs, refMap, typeMap, this); // Arguments may need to be cast, e.g., list expression to a // header type. diff --git a/testdata/p4_16_samples/list8.p4 b/testdata/p4_16_samples/list8.p4 new file mode 100644 index 00000000000..be3c4616d10 --- /dev/null +++ b/testdata/p4_16_samples/list8.p4 @@ -0,0 +1,23 @@ +#include + +extern E { + E(list>> data); + void run(); +} + +control c() { + E( + (list>>) + { + (list>){10, 6, 3}, + (list>){5, 2} + }) e; + apply { + e.run(); + } +} + +control C(); +package top(C _c); + +top(c()) main; diff --git a/testdata/p4_16_samples_outputs/list-first.p4 b/testdata/p4_16_samples_outputs/list-first.p4 index ae92b72739c..9165018ce72 100644 --- a/testdata/p4_16_samples_outputs/list-first.p4 +++ b/testdata/p4_16_samples_outputs/list-first.p4 @@ -7,6 +7,7 @@ extern E { control c() { E((list>){32w2,32w3,32w4}) e; + bit<32> list; apply { e.run(); } @@ -15,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list-frontend.p4 b/testdata/p4_16_samples_outputs/list-frontend.p4 index 5170dadf293..bbccfe14f4e 100644 --- a/testdata/p4_16_samples_outputs/list-frontend.p4 +++ b/testdata/p4_16_samples_outputs/list-frontend.p4 @@ -15,4 +15,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list-midend.p4 b/testdata/p4_16_samples_outputs/list-midend.p4 index 6d964575875..e345b466dd5 100644 --- a/testdata/p4_16_samples_outputs/list-midend.p4 +++ b/testdata/p4_16_samples_outputs/list-midend.p4 @@ -7,21 +7,20 @@ extern E { control c() { @name("c.e") E((list>){32w2,32w3,32w4}) e_0; - @hidden action list11() { + @hidden action list12() { e_0.run(); } - @hidden table tbl_list11 { + @hidden table tbl_list12 { actions = { - list11(); + list12(); } - const default_action = list11(); + const default_action = list12(); } apply { - tbl_list11.apply(); + tbl_list12.apply(); } } control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list.p4 b/testdata/p4_16_samples_outputs/list.p4 index 41f33553902..3d925770bca 100644 --- a/testdata/p4_16_samples_outputs/list.p4 +++ b/testdata/p4_16_samples_outputs/list.p4 @@ -7,6 +7,7 @@ extern E { control c() { E((list>){ 2, 3, 4 }) e; + bit<32> list; apply { e.run(); } @@ -15,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list8-first.p4 b/testdata/p4_16_samples_outputs/list8-first.p4 new file mode 100644 index 00000000000..3d2638117c9 --- /dev/null +++ b/testdata/p4_16_samples_outputs/list8-first.p4 @@ -0,0 +1,17 @@ +#include + +extern E { + E(list>> data); + void run(); +} + +control c() { + E((list>>){(list>){32w10,32w6,32w3},(list>){32w5,32w2}}) e; + apply { + e.run(); + } +} + +control C(); +package top(C _c); +top(c()) main; diff --git a/testdata/p4_16_samples_outputs/list8-frontend.p4 b/testdata/p4_16_samples_outputs/list8-frontend.p4 new file mode 100644 index 00000000000..34cd6249f5e --- /dev/null +++ b/testdata/p4_16_samples_outputs/list8-frontend.p4 @@ -0,0 +1,17 @@ +#include + +extern E { + E(list>> data); + void run(); +} + +control c() { + @name("c.e") E((list>>){(list>){32w10,32w6,32w3},(list>){32w5,32w2}}) e_0; + apply { + e_0.run(); + } +} + +control C(); +package top(C _c); +top(c()) main; diff --git a/testdata/p4_16_samples_outputs/list8-midend.p4 b/testdata/p4_16_samples_outputs/list8-midend.p4 new file mode 100644 index 00000000000..c94904a1f7a --- /dev/null +++ b/testdata/p4_16_samples_outputs/list8-midend.p4 @@ -0,0 +1,26 @@ +#include + +extern E { + E(list>> data); + void run(); +} + +control c() { + @name("c.e") E((list>>){(list>){32w10,32w6,32w3},(list>){32w5,32w2}}) e_0; + @hidden action list8l16() { + e_0.run(); + } + @hidden table tbl_list8l16 { + actions = { + list8l16(); + } + const default_action = list8l16(); + } + apply { + tbl_list8l16.apply(); + } +} + +control C(); +package top(C _c); +top(c()) main; diff --git a/testdata/p4_16_samples_outputs/list8.p4 b/testdata/p4_16_samples_outputs/list8.p4 new file mode 100644 index 00000000000..0dc5716343d --- /dev/null +++ b/testdata/p4_16_samples_outputs/list8.p4 @@ -0,0 +1,17 @@ +#include + +extern E { + E(list>> data); + void run(); +} + +control c() { + E((list>>){ (list>){ 10, 6, 3 }, (list>){ 5, 2 } }) e; + apply { + e.run(); + } +} + +control C(); +package top(C _c); +top(c()) main; diff --git a/testdata/p4_16_samples_outputs/list8.p4-stderr b/testdata/p4_16_samples_outputs/list8.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d