File tree 2 files changed +47
-2
lines changed
compiler/src/dotty/tools/dotc/transform 2 files changed +47
-2
lines changed Original file line number Diff line number Diff line change @@ -698,13 +698,15 @@ object PatternMatcher {
698
698
for ((rhs, _) <- seenVars if ! seenAtLabel(plan.label).contains(rhs))
699
699
yield (rhs, newVar(rhs.tree, Param ))
700
700
}
701
- plan.args =
701
+ val newArgs =
702
702
for {
703
703
(rhs, actual) <- seenVars.toList
704
704
formal <- paramsOfLabel(plan.label).get(rhs)
705
705
}
706
706
yield (formal -> actual)
707
- plan
707
+ if (plan.args.isEmpty) { plan.args = newArgs; plan }
708
+ else if (newArgs == plan.args) plan
709
+ else CallPlan (plan.label, newArgs)
708
710
}
709
711
}
710
712
(new Merge (Map ()))(plan)
Original file line number Diff line number Diff line change
1
+ class TreeAccumulator2 {
2
+
3
+ def foo (tasty : Tasty2 )(tree : Any ): Unit = {
4
+ import tasty ._
5
+ tree match {
6
+ case A () =>
7
+ case B () =>
8
+ case C () =>
9
+ case D () =>
10
+ }
11
+ }
12
+
13
+ }
14
+
15
+ abstract class Tasty2 {
16
+
17
+ type X
18
+ type Y
19
+
20
+ implicit def xct : scala.reflect.ClassTag [X ]
21
+ implicit def yct : scala.reflect.ClassTag [Y ]
22
+
23
+ val A : AExtractor
24
+ trait AExtractor {
25
+ def unapply (x : X ): Boolean
26
+ }
27
+
28
+ val B : BExtractor
29
+ trait BExtractor {
30
+ def unapply (x : X ): Boolean
31
+ }
32
+
33
+ val C : CExtractor
34
+ trait CExtractor {
35
+ def unapply (x : Y ): Boolean // Note the type Y
36
+ }
37
+
38
+ val D : DExtractor
39
+ trait DExtractor {
40
+ def unapply (x : X ): Boolean
41
+ }
42
+
43
+ }
You can’t perform that action at this time.
0 commit comments