File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -736,8 +736,7 @@ trait Applications extends Compatibility { self: Typer =>
736
736
}
737
737
738
738
unapplyFn.tpe.widen match {
739
- case mt : MethodType if mt.paramTypes.length == 1 && ! mt.isDependent =>
740
- val m = mt
739
+ case mt : MethodType if mt.paramTypes.length == 1 =>
741
740
val unapplyArgType = mt.paramTypes.head
742
741
unapp.println(i " unapp arg tpe = $unapplyArgType, pt = $selType" )
743
742
def wpt = widenForMatchSelector(selType) // needed?
@@ -778,7 +777,7 @@ trait Applications extends Compatibility { self: Typer =>
778
777
tree.pos)
779
778
}
780
779
781
- val dummyArg = dummyTreeOfType(unapplyArgType )
780
+ val dummyArg = dummyTreeOfType(ownType )
782
781
val unapplyApp = typedExpr(untpd.TypedSplice (Apply (unapplyFn, dummyArg :: Nil )))
783
782
val unapplyImplicits = unapplyApp match {
784
783
case Apply (Apply (unapply, `dummyArg` :: Nil ), args2) => assert(args2.nonEmpty); args2
Original file line number Diff line number Diff line change
1
+ object Test {
2
+
3
+ abstract class C { type T ; val x : T }
4
+
5
+ val c = new C { type T = Int ; val x = 1 }
6
+
7
+ object X { def unapply (x : C ): Some [x.T ] = Some (x.x) }
8
+
9
+ val y = c match { case X (y) => y }
10
+ val y1 : Int = y
11
+
12
+ val z = (c : Any ) match { case X (y) => y }
13
+ val z1 : C # T = z
14
+ }
You can’t perform that action at this time.
0 commit comments