From c8867573fee65f2e0bf77b02f5e51c77ef5baf92 Mon Sep 17 00:00:00 2001 From: Gene Gleyzer Date: Fri, 3 Jun 2022 12:12:38 -0400 Subject: [PATCH] Improve error reporting for NewExpression --- .../src/main/java/org/xvm/compiler/ast/NewExpression.java | 7 ++++--- javatools/src/main/java/org/xvm/tool/Compiler.java | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/javatools/src/main/java/org/xvm/compiler/ast/NewExpression.java b/javatools/src/main/java/org/xvm/compiler/ast/NewExpression.java index e969258b01..4757eac187 100644 --- a/javatools/src/main/java/org/xvm/compiler/ast/NewExpression.java +++ b/javatools/src/main/java/org/xvm/compiler/ast/NewExpression.java @@ -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; } @@ -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"); - } + } \ No newline at end of file diff --git a/javatools/src/main/java/org/xvm/tool/Compiler.java b/javatools/src/main/java/org/xvm/tool/Compiler.java index e3eebbb180..b317b5d55b 100644 --- a/javatools/src/main/java/org/xvm/tool/Compiler.java +++ b/javatools/src/main/java/org/xvm/tool/Compiler.java @@ -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) @@ -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; }