Skip to content

Allow for missing type symbols in needsRewire #11744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/transform/HoistSuperArgs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ class HoistSuperArgs extends MiniPhase with IdentityDenotTransformer { thisPhase
/** Only rewire types that are owned by the current Hoister and is an param or accessor */
def needsRewire(tp: Type) = tp match {
case ntp: NamedType =>
(ntp.symbol.owner == cls || ntp.symbol.owner == constr) && ntp.symbol.isParamOrAccessor
val owner = ntp.symbol.maybeOwner
(owner == cls || owner == constr) && ntp.symbol.isParamOrAccessor
case _ => false
}

Expand Down
23 changes: 23 additions & 0 deletions tests/pos/i11732.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import scala.deriving._

trait TupleConversion[A, B] {
def to(a: A): B
def from(b: B): A
}

object TupleConversion {
inline given autoTupleConversion[Prod <: Product](using m: Mirror.ProductOf[Prod]): TupleConversion[Prod, m.MirroredElemTypes] =
new TupleConversion[Prod, m.MirroredElemTypes] {
def to(a: Prod): m.MirroredElemTypes = Tuple.fromProductTyped(a)
def from(b: m.MirroredElemTypes): Prod = m.fromProduct(b)
}
}

final case class Data(s0: Int, s1: Int)

abstract class BaseSpec(f: () => Unit)

object ProductBuilderTest
extends BaseSpec(() => {
val conv = implicitly[TupleConversion[Data, (Int, Int)]]
})