File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -293,6 +293,10 @@ object Names {
293293 else {
294294 if (Config .checkBackendNames) {
295295 if (! toStringOK) {
296+ // We print the stacktrace instead of doing an assert directly,
297+ // because asserts are caught in exception handlers which might
298+ // cause other failures. In that case the first, important failure
299+ // is lost.
296300 println(" Backend should not call Name#toString, Name#mangledString should be used instead." )
297301 new Error ().printStackTrace()
298302 assert(false )
@@ -301,6 +305,9 @@ object Names {
301305 new String (chrs, start, length)
302306 }
303307
308+ /** It's OK to take a toString if the stacktrace does not occur a method
309+ * in GenBCode or it also contains one of the whitelisted methods below.
310+ */
304311 private def toStringOK = {
305312 val trace = Thread .currentThread.getStackTrace
306313 ! trace.exists(_.getClassName.endsWith(" GenBCode" )) ||
You can’t perform that action at this time.
0 commit comments