File tree 1 file changed +7
-0
lines changed
compiler/src/dotty/tools/dotc/core 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -293,6 +293,10 @@ object Names {
293
293
else {
294
294
if (Config .checkBackendNames) {
295
295
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.
296
300
println(" Backend should not call Name#toString, Name#mangledString should be used instead." )
297
301
new Error ().printStackTrace()
298
302
assert(false )
@@ -301,6 +305,9 @@ object Names {
301
305
new String (chrs, start, length)
302
306
}
303
307
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
+ */
304
311
private def toStringOK = {
305
312
val trace = Thread .currentThread.getStackTrace
306
313
! trace.exists(_.getClassName.endsWith(" GenBCode" )) ||
You can’t perform that action at this time.
0 commit comments