diff --git a/frontends/common/resolveReferences/resolveReferences.cpp b/frontends/common/resolveReferences/resolveReferences.cpp index 336795e3af0..9997246da16 100644 --- a/frontends/common/resolveReferences/resolveReferences.cpp +++ b/frontends/common/resolveReferences/resolveReferences.cpp @@ -171,6 +171,9 @@ const IR::Vector *ResolutionContext::methodArguments(cstring name) if (auto type = decl->type->to()) { if (type->path->name == name) return decl->arguments; } + if (auto ts = decl->type->to()) { + if (ts->baseType->path->name == name) + return decl->arguments; } break; } if (ctxt->node->is() || ctxt->node->is()) ctxt = ctxt->parent; diff --git a/testdata/p4_16_samples/issue3379-1.p4 b/testdata/p4_16_samples/issue3379-1.p4 new file mode 100644 index 00000000000..de8200ffb02 --- /dev/null +++ b/testdata/p4_16_samples/issue3379-1.p4 @@ -0,0 +1,14 @@ +parser mypt(in t tt); + +parser MyParser1(in bit tt) { + state start { + transition select(tt) { + 0: accept; + _: reject; + } + } +} + +package mypackaget(mypt t2); +package mypackaget(mypt t1, mypt t2); +mypackaget(MyParser1()) t4; diff --git a/testdata/p4_16_samples/issue3379.p4 b/testdata/p4_16_samples/issue3379.p4 new file mode 100644 index 00000000000..4e0d666e124 --- /dev/null +++ b/testdata/p4_16_samples/issue3379.p4 @@ -0,0 +1,15 @@ +parser mypt(in t tt); + +parser MyParser1(in bit tt) { + state start { + transition select(tt) { + 0: accept; + _: reject; + } + } +} + +typedef bit t; +package mypackaget(mypt t2); +package mypackaget(mypt t1, mypt t2); +mypackaget(MyParser1()) t4; diff --git a/testdata/p4_16_samples_outputs/issue3379-1-first.p4 b/testdata/p4_16_samples_outputs/issue3379-1-first.p4 new file mode 100644 index 00000000000..64b9e488ee2 --- /dev/null +++ b/testdata/p4_16_samples_outputs/issue3379-1-first.p4 @@ -0,0 +1,14 @@ +parser mypt(in t tt); +parser MyParser1(in bit<1> tt) { + state start { + transition select(tt) { + 1w0: accept; + default: reject; + } + } +} + +package mypackaget(mypt t2); +package mypackaget(mypt t1, mypt t2); +mypackaget>(MyParser1()) t4; + diff --git a/testdata/p4_16_samples_outputs/issue3379-1-frontend.p4 b/testdata/p4_16_samples_outputs/issue3379-1-frontend.p4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/issue3379-1.p4 b/testdata/p4_16_samples_outputs/issue3379-1.p4 new file mode 100644 index 00000000000..c58787a6dce --- /dev/null +++ b/testdata/p4_16_samples_outputs/issue3379-1.p4 @@ -0,0 +1,14 @@ +parser mypt(in t tt); +parser MyParser1(in bit<1> tt) { + state start { + transition select(tt) { + 0: accept; + default: reject; + } + } +} + +package mypackaget(mypt t2); +package mypackaget(mypt t1, mypt t2); +mypackaget>(MyParser1()) t4; + diff --git a/testdata/p4_16_samples_outputs/issue3379-1.p4-stderr b/testdata/p4_16_samples_outputs/issue3379-1.p4-stderr new file mode 100644 index 00000000000..d475f7dac1a --- /dev/null +++ b/testdata/p4_16_samples_outputs/issue3379-1.p4-stderr @@ -0,0 +1,4 @@ +issue3379-1.p4(14): [--Wwarn=unused] warning: t4: unused instance +mypackaget(MyParser1()) t4; + ^^ +[--Wwarn=missing] warning: Program does not contain a `main' module diff --git a/testdata/p4_16_samples_outputs/issue3379-first.p4 b/testdata/p4_16_samples_outputs/issue3379-first.p4 new file mode 100644 index 00000000000..8d5190817af --- /dev/null +++ b/testdata/p4_16_samples_outputs/issue3379-first.p4 @@ -0,0 +1,15 @@ +parser mypt(in t tt); +parser MyParser1(in bit<1> tt) { + state start { + transition select(tt) { + 1w0: accept; + default: reject; + } + } +} + +typedef bit<1> t; +package mypackaget(mypt t2); +package mypackaget(mypt t1, mypt t2); +mypackaget(MyParser1()) t4; + diff --git a/testdata/p4_16_samples_outputs/issue3379-frontend.p4 b/testdata/p4_16_samples_outputs/issue3379-frontend.p4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/issue3379.p4 b/testdata/p4_16_samples_outputs/issue3379.p4 new file mode 100644 index 00000000000..08044d87711 --- /dev/null +++ b/testdata/p4_16_samples_outputs/issue3379.p4 @@ -0,0 +1,15 @@ +parser mypt(in t tt); +parser MyParser1(in bit<1> tt) { + state start { + transition select(tt) { + 0: accept; + default: reject; + } + } +} + +typedef bit<1> t; +package mypackaget(mypt t2); +package mypackaget(mypt t1, mypt t2); +mypackaget(MyParser1()) t4; + diff --git a/testdata/p4_16_samples_outputs/issue3379.p4-stderr b/testdata/p4_16_samples_outputs/issue3379.p4-stderr new file mode 100644 index 00000000000..e53b6054b4c --- /dev/null +++ b/testdata/p4_16_samples_outputs/issue3379.p4-stderr @@ -0,0 +1,4 @@ +issue3379.p4(15): [--Wwarn=unused] warning: t4: unused instance +mypackaget(MyParser1()) t4; + ^^ +[--Wwarn=missing] warning: Program does not contain a `main' module