Skip to content

Commit 70af177

Browse files
authored
Merge pull request #11744 from dotty-staging/fix-11732
Allow for missing type symbols in needsRewire
2 parents 8f018f8 + e36ec5d commit 70af177

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

compiler/src/dotty/tools/dotc/transform/HoistSuperArgs.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ class HoistSuperArgs extends MiniPhase with IdentityDenotTransformer { thisPhase
119119
/** Only rewire types that are owned by the current Hoister and is an param or accessor */
120120
def needsRewire(tp: Type) = tp match {
121121
case ntp: NamedType =>
122-
(ntp.symbol.owner == cls || ntp.symbol.owner == constr) && ntp.symbol.isParamOrAccessor
122+
val owner = ntp.symbol.maybeOwner
123+
(owner == cls || owner == constr) && ntp.symbol.isParamOrAccessor
123124
case _ => false
124125
}
125126

tests/pos/i11732.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import scala.deriving._
2+
3+
trait TupleConversion[A, B] {
4+
def to(a: A): B
5+
def from(b: B): A
6+
}
7+
8+
object TupleConversion {
9+
inline given autoTupleConversion[Prod <: Product](using m: Mirror.ProductOf[Prod]): TupleConversion[Prod, m.MirroredElemTypes] =
10+
new TupleConversion[Prod, m.MirroredElemTypes] {
11+
def to(a: Prod): m.MirroredElemTypes = Tuple.fromProductTyped(a)
12+
def from(b: m.MirroredElemTypes): Prod = m.fromProduct(b)
13+
}
14+
}
15+
16+
final case class Data(s0: Int, s1: Int)
17+
18+
abstract class BaseSpec(f: () => Unit)
19+
20+
object ProductBuilderTest
21+
extends BaseSpec(() => {
22+
val conv = implicitly[TupleConversion[Data, (Int, Int)]]
23+
})

0 commit comments

Comments
 (0)