File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed
Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,35 @@ AsmAnalysisInfo AsmAnalyzer::analyzeStrictAssertCorrect(
108108 {},
109109 std::move (_objectStructure)
110110 ).analyze (_astRoot);
111- yulAssert (success && !errors.hasErrors (), " Invalid assembly/yul code." );
111+
112+ if (!success)
113+ {
114+ auto formatErrors = [](ErrorList const & _errorList) {
115+ std::vector<std::string> formattedErrors;
116+ for (std::shared_ptr<Error const > const & error: _errorList)
117+ {
118+ yulAssert (error->comment ());
119+ formattedErrors.push_back (fmt::format (
120+ // Intentionally not showing source locations because we don't have the original
121+ // source here and it's unlikely they match the pretty-printed version.
122+ // They may not even match the original source if the AST was modified by the optimizer.
123+ " - {} {}: {}" ,
124+ Error::formatErrorType (error->type ()),
125+ error->errorId ().error ,
126+ *error->comment ()
127+ ));
128+ }
129+ return joinHumanReadable (formattedErrors, " \n " );
130+ };
131+
132+ yulAssert (errors.hasErrors (), " Yul analysis failed but did not report any errors." );
133+ yulAssert (false , fmt::format (
134+ " {}\n\n Expected valid Yul, but errors were reported during analysis:\n {}" ,
135+ AsmPrinter{_dialect}(_astRoot),
136+ formatErrors (errorList)
137+ ));
138+ }
139+
112140 return analysisInfo;
113141}
114142
You can’t perform that action at this time.
0 commit comments