Skip to content

Commit cf72b49

Browse files
committed
Update diagnostic message
1 parent b519bab commit cf72b49

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/AST/ASTGates.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ ASTGateNode::ASTGateNode(const ASTIdentifierNode *Id,
11331133

11341134
if (C != Params.size()) {
11351135
std::stringstream M;
1136-
M << "Inconsistent number of Params." << C;
1136+
M << "Inconsistent number of parameters in the gate call for the corresponding gate definition" << C;
11371137
QasmDiagnosticEmitter::Instance().EmitDiagnostic(
11381138
DIAGLineCounter::Instance().GetLocation(), M.str(), DiagLevel::Error);
11391139
return;
@@ -1369,7 +1369,13 @@ ASTGateNode::ASTGateNode(const ASTIdentifierNode *Id,
13691369
++C;
13701370
}
13711371

1372-
assert(C == Params.size() && "Inconsistent number of Params!");
1372+
if (C != Params.size()) {
1373+
std::stringstream M;
1374+
M << "Inconsistent number of parameters in the gate call for the corresponding gate definition" << C;
1375+
QasmDiagnosticEmitter::Instance().EmitDiagnostic(
1376+
DIAGLineCounter::Instance().GetLocation(), M.str(), DiagLevel::Error);
1377+
return;
1378+
}
13731379

13741380
for (std::vector<ASTAngleNode *>::const_iterator I = Params.begin();
13751381
I != Params.end(); ++I) {

0 commit comments

Comments
 (0)