Skip to content

Commit

Permalink
remove dbp from user facing error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Dodd committed Apr 15, 2017
1 parent c4fbb6c commit a9d1256
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 16 deletions.
2 changes: 1 addition & 1 deletion frontends/p4/typeChecking/typeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const IR::Type* TypeInference::getType(const IR::Node* element, bool verbose) co
const IR::Type* TypeInference::getTypeType(const IR::Node* element) const {
const IR::Type* result = typeMap->getType(element);
if (result == nullptr) {
typeError("Could not find type of %1%", dbp(element));
typeError("Could not find type of %1%", element);
return nullptr;
}
BUG_CHECK(result->is<IR::Type_Type>(), "%1%: expected a TypeType", dbp(result));
Expand Down
16 changes: 12 additions & 4 deletions testdata/p4_16_errors_outputs/extern.p4-stderr
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
../testdata/p4_16_errors/extern.p4(19): error: x: a parameter with an extern type cannot have a direction
control c(in X x) { // Cannot have externs with direction
^
error: Could not find type of <Type_Control>(19) c
../testdata/p4_16_errors/extern.p4(19): error: Could not find type of control c
control c(in X x) { // Cannot have externs with direction
^
../testdata/p4_16_errors/extern.p4(24): error: x: a parameter with an extern type cannot have a direction
control proto(in X x);
^
../testdata/p4_16_errors/extern.p4(24): error: Could not find type of control proto
control proto(in X x);
^^^^^
error: Could not find type of <Type_Name>(37) proto
../testdata/p4_16_errors/extern.p4(25): error: Could not find type of proto
package top(proto _c);
^^^^^
../testdata/p4_16_errors/extern.p4(25): error: Could not find type of _c
package top(proto _c);
^^
Expand All @@ -18,5 +22,9 @@ package top(proto _c);
../testdata/p4_16_errors/extern.p4(19): error: Could not find type of control c
control c(in X x) { // Cannot have externs with direction
^
error: Could not find type of <Type_Name>(45) c
error: Could not find type of <Type_Name>(43) top
../testdata/p4_16_errors/extern.p4(27): error: Could not find type of c
top(c()) main;
^
../testdata/p4_16_errors/extern.p4(27): error: Could not find type of top
top(c()) main;
^^^
16 changes: 12 additions & 4 deletions testdata/p4_16_errors_outputs/generic1_e.p4-stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,30 @@ control p1(If x) // missing type parameter
../testdata/p4_16_errors/generic1_e.p4(21): error: Could not find type of x
control p1(If x) // missing type parameter
^
error: Could not find type of <Type_Control>(31) p1
../testdata/p4_16_errors/generic1_e.p4(21): error: Could not find type of control p1
control p1(If x) // missing type parameter
^^
../testdata/p4_16_errors/generic1_e.p4(26): error: If<...>: Type If has 1 type parameter(s), but it is specialized with 2
control p2(If<int<32>, int<32>> x) // too many type parameters
^^^^^^^^^^^^^^^^^^^^
../testdata/p4_16_errors/generic1_e.p4(16)
extern If<T>
^^
error: Could not find type of <Type_Specialized>(48)
../testdata/p4_16_errors/generic1_e.p4(26): error: Could not find type of If<...>
control p2(If<int<32>, int<32>> x) // too many type parameters
^^^^^^^^^^^^^^^^^^^^
../testdata/p4_16_errors/generic1_e.p4(26): error: Could not find type of x
control p2(If<int<32>, int<32>> x) // too many type parameters
^
error: Could not find type of <Type_Control>(52) p2
../testdata/p4_16_errors/generic1_e.p4(26): error: Could not find type of control p2
control p2(If<int<32>, int<32>> x) // too many type parameters
^^
../testdata/p4_16_errors/generic1_e.p4(36): error: h<...>: Type header h is not generic and thus it cannot be specialized using type arguments
h<bit> x; // no type parameter
^^^^^^
../testdata/p4_16_errors/generic1_e.p4(31)
header h {}
^
error: Could not find type of <Type_Specialized>(73)
../testdata/p4_16_errors/generic1_e.p4(36): error: Could not find type of h<...>
h<bit> x; // no type parameter
^^^^^^
28 changes: 21 additions & 7 deletions testdata/p4_16_errors_outputs/parser-arg.p4-stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ parser Parser();
../testdata/p4_16_errors/parser-arg.p4(18): error: Could not find type of parser MyParser
parser MyParser(Parser p);
^^^^^^^^
error: Could not find type of <Type_Name>(23) MyParser
../testdata/p4_16_errors/parser-arg.p4(19): error: Could not find type of MyParser
package Package(MyParser p1, MyParser p2);
^^^^^^^^
../testdata/p4_16_errors/parser-arg.p4(18): error: Could not find type of parser MyParser
parser MyParser(Parser p);
^^^^^^^^
error: Could not find type of <Type_Name>(27) MyParser
../testdata/p4_16_errors/parser-arg.p4(19): error: Could not find type of MyParser
package Package(MyParser p1, MyParser p2);
^^^^^^^^
../testdata/p4_16_errors/parser-arg.p4(19): error: Could not find type of p1
package Package(MyParser p1, MyParser p2);
^^
Expand All @@ -21,22 +25,30 @@ parser Parser1(Parser p) {
../testdata/p4_16_errors/parser-arg.p4(17)
parser Parser();
^^^^^^
error: Could not find type of <Type_Parser>(38) Parser1
../testdata/p4_16_errors/parser-arg.p4(21): error: Could not find type of parser Parser1
parser Parser1(Parser p) {
^^^^^^^
../testdata/p4_16_errors/parser-arg.p4(28): error: p: parameter cannot have type parser Parser
parser Parser2(Parser p) {
^
../testdata/p4_16_errors/parser-arg.p4(17)
parser Parser();
^^^^^^
error: Could not find type of <Type_Parser>(63) Parser2
../testdata/p4_16_errors/parser-arg.p4(28): error: Could not find type of parser Parser2
parser Parser2(Parser p) {
^^^^^^^
../testdata/p4_16_errors/parser-arg.p4(21): error: Could not find type of parser Parser1
parser Parser1(Parser p) {
^^^^^^^
error: Could not find type of <Type_Name>(81) Parser1
../testdata/p4_16_errors/parser-arg.p4(35): error: Could not find type of Parser1
Parser1() p1;
^^^^^^^
../testdata/p4_16_errors/parser-arg.p4(28): error: Could not find type of parser Parser2
parser Parser2(Parser p) {
^^^^^^^
error: Could not find type of <Type_Name>(86) Parser2
../testdata/p4_16_errors/parser-arg.p4(36): error: Could not find type of Parser2
Parser2() p2;
^^^^^^^
../testdata/p4_16_errors/parser-arg.p4(19): error: Could not find type of package Package
package Package(MyParser p1, MyParser p2);
^^^^^^^
Expand All @@ -46,4 +58,6 @@ Parser1() p1;
../testdata/p4_16_errors/parser-arg.p4(36): error: Could not find type of p2
Parser2() p2;
^^
error: Could not find type of <Type_Name>(91) Package
../testdata/p4_16_errors/parser-arg.p4(38): error: Could not find type of Package
Package(p1,p2) main;
^^^^^^^

0 comments on commit a9d1256

Please sign in to comment.