Skip to content

Commit

Permalink
Revert "Drop inaccessible subclasses from refineUsingParent" (#21895)
Browse files Browse the repository at this point in the history
Reverts #21799

The following changes were merged at the ~same time as adding the
`tests/warn/i21860.scala` test, which are breaking that test. We revert
it for now to unblock merging to `main`.
  • Loading branch information
hamzaremmal authored Nov 7, 2024
2 parents 63849a0 + cecd053 commit 4ae5d61
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Decorators.scala
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ object Decorators {
case _ => String.valueOf(x).nn

/** Returns the simple class name of `x`. */
def className: String = if x == null then "<null>" else x.getClass.getSimpleName.nn
def className: String = x.getClass.getSimpleName.nn

extension [T](x: T)
def assertingErrorsReported(using Context): T = {
Expand Down
6 changes: 1 addition & 5 deletions compiler/src/dotty/tools/dotc/core/TypeOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -930,11 +930,7 @@ object TypeOps:
for tp <- mixins.reverseIterator do
protoTp1 <:< tp
maximizeType(protoTp1, NoSpan)
val inst = wildApprox(protoTp1)
if !inst.classSymbol.exists then
// E.g. i21790, can't instantiate S#CA as a subtype of O.A, because O.CA isn't accessible
NoType
else inst
wildApprox(protoTp1)
}

if (protoTp1 <:< tp2) instantiate()
Expand Down
14 changes: 0 additions & 14 deletions tests/pos/i21790.scala

This file was deleted.

0 comments on commit 4ae5d61

Please sign in to comment.