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