Skip to content

Commit c835586

Browse files
authored
Merge pull request #2984 from dotty-staging/fix-inline-lambda
Fix #2980: Crash when inlining HK type parameters
2 parents 2c1e646 + d73b383 commit c835586

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ final class TreeTypeMap(
9898
case ann => ann
9999
}
100100
res
101+
case tdef @ LambdaTypeTree(tparams, body) =>
102+
val (tmap1, tparams1) = transformDefs(tparams)
103+
cpy.LambdaTypeTree(tdef)(tparams1, tmap1.transform(body))
101104
case blk @ Block(stats, expr) =>
102105
val (tmap1, stats1) = transformDefs(stats)
103106
val expr1 = tmap1.transform(expr)

tests/pos/i2980.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
trait Foo {
2+
def apply[~>[_,_]](x: Int ~> Int): Int ~> Int
3+
}
4+
5+
object Foo {
6+
inline def foo: Foo = new Foo {
7+
def apply[~>[_,_]](x: Int ~> Int): Int ~> Int = x
8+
}
9+
10+
def main(args: Array[String]): Unit = {
11+
val x = foo((x: Int) => x)
12+
}
13+
}

0 commit comments

Comments
 (0)