File tree 2 files changed +25
-1
lines changed
compiler/src/dotty/tools/dotc/transform
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,8 @@ class HoistSuperArgs extends MiniPhase with IdentityDenotTransformer { thisPhase
119
119
/** Only rewire types that are owned by the current Hoister and is an param or accessor */
120
120
def needsRewire (tp : Type ) = tp match {
121
121
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
123
124
case _ => false
124
125
}
125
126
Original file line number Diff line number Diff line change
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
+ })
You can’t perform that action at this time.
0 commit comments