Skip to content

Commit 2b6a197

Browse files
committed
Merge pull request scala#4274 from retronym/ticket/9123
SI-9123 More coherent trees with patmat, dependent types
2 parents d7b1152 + 9735108 commit 2b6a197

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/compiler/scala/tools/nsc/transform/patmat/PatternMatching.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ trait Interface extends ast.TreeDSL {
239239
case Ident(_) => subst(from, to)
240240
case _ => super.transform(tree)
241241
}
242+
tree1 match {
243+
case _: DefTree =>
244+
tree1.symbol.modifyInfo(_.substituteTypes(from, toTypes))
245+
case _ =>
246+
}
242247
tree1.modifyType(_.substituteTypes(from, toTypes))
243248
}
244249
}

test/files/pos/t9123.flags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-optimize -Ydelambdafy:method

test/files/pos/t9123.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
trait Setting {
2+
type T
3+
def value: T
4+
}
5+
6+
object Test {
7+
def test(x: Some[Setting]) = x match {
8+
case Some(dep) => Some(dep.value) map (_ => true)
9+
}
10+
}

0 commit comments

Comments
 (0)