Skip to content

Commit 19d96eb

Browse files
committed
Generalize leak avoidance
Leaks can be avoided by following type aliases. Previously, this was only done if the checked symbol is a term. But it is not clear why types should not get the same treatment. This avoids a problem in pos/reference/exports.scala.
1 parent f11239e commit 19d96eb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,12 @@ object Checking {
499499
var tp1 =
500500
if (isLeaked(tp.symbol)) {
501501
errors =
502-
(() => em"non-private $sym refers to private ${tp.symbol}\nin its type signature ${sym.info}") :: errors
502+
(() => em"non-private ${sym.showLocated} refers to private ${tp.symbol}\nin its type signature ${sym.info}") ::
503+
errors
503504
tp
504505
}
505506
else mapOver(tp)
506-
if ((errors ne prevErrors) && !sym.isType && tp.info.isTypeAlias) {
507+
if ((errors ne prevErrors) && tp.info.isTypeAlias) {
507508
// try to dealias to avoid a leak error
508509
val savedErrors = errors
509510
errors = prevErrors

0 commit comments

Comments
 (0)