Skip to content

Commit 0b92f7b

Browse files
committed
Fix scala#2378: add tests and address review feedback
1 parent 50435c2 commit 0b92f7b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
354354
case Bind(_, pat) => project(pat)
355355
case UnApply(_, _, pats) =>
356356
if (pat.tpe.classSymbol.is(CaseClass))
357+
// FIXME: why dealias is needed here?
357358
Kon(pat.tpe.stripAnnots.dealias, pats.map(pat => project(pat, roundUp)))
358359
else if (roundUp) Typ(pat.tpe.stripAnnots, false)
359360
else Empty

tests/pos/i2378.scala

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
trait Cap
2+
3+
trait Toolbox {
4+
type Tree
5+
6+
val tpd: TypedTrees
7+
trait TypedTrees {
8+
type Tree
9+
}
10+
11+
val Apply: ApplyImpl
12+
trait ApplyImpl {
13+
def unapply(tree: Tree): Option[(Tree, Seq[Tree])]
14+
def unapply(tree: tpd.Tree)(implicit c: Cap): Option[(tpd.Tree, Seq[tpd.Tree])]
15+
}
16+
}
17+
18+
class Test(val tb: Toolbox) {
19+
import tb._
20+
implicit val cap: Cap = null
21+
22+
def foo(tree: Tree): Int = tree match {
23+
case Apply(fun, args) => 3
24+
}
25+
26+
def bar(tree: tpd.Tree): Int = tree match {
27+
case Apply(fun, args) => 3
28+
}
29+
}

0 commit comments

Comments
 (0)