Skip to content

Commit

Permalink
Improve error reporting for NewExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
Gene Gleyzer committed Jun 3, 2022
1 parent 34dfcc7 commit c886757
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -619,10 +619,11 @@ else if (type instanceof ArrayTypeExpression exprArray)
}

// unless it's a virtual new, the target type must be new-able
if (!fVirt && !infoTarget.isNewable(errs))
if (!fVirt && !infoTarget.isNewable(errsTemp))
{
String sTarget = infoTarget.getType().removeAccess().getValueString();
reportNotNewable(sTarget, infoTarget, null, errs);
reportNotNewable(sTarget, infoTarget, null, errsTemp);
errsTemp.merge();
return null;
}

Expand Down Expand Up @@ -1826,4 +1827,4 @@ private enum AnonPurpose {None, RoughDraft, CaptureAnalysis, Actual}
private transient boolean m_fDynamicAnno;

private static final Field[] CHILD_FIELDS = fieldsForNames(NewExpression.class, "left", "type", "args", "anon");
}
}
5 changes: 3 additions & 2 deletions javatools/src/main/java/org/xvm/tool/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ protected void log(ErrorList errs)

if (cErrs > 0)
{
// if there are any COMPILER errors, suppress all VERIFY errors
// if there are any COMPILER errors, suppress all VERIFY errors except the first three
boolean fSuppressVerify = false;

for (ErrorInfo err : listErrs)
Expand All @@ -489,9 +489,10 @@ protected void log(ErrorList errs)
}
}

int cVerify = 0;
for (ErrorInfo err : listErrs)
{
if (fSuppressVerify && err.getCode().startsWith("VERIFY"))
if (fSuppressVerify && err.getCode().startsWith("VERIFY") && ++cVerify > 3)
{
continue;
}
Expand Down

0 comments on commit c886757

Please sign in to comment.