Skip to content

Commit 0a1fbfa

Browse files
committed
Handle HKLambdaType in new expression
1 parent 58c8dc1 commit 0a1fbfa

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

compiler/src/dotty/tools/dotc/transform/init/Summarization.scala

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,26 @@ object Summarization {
7777
Summary.empty
7878

7979
case New(tpt) =>
80-
tpt.tpe.typeConstructor match {
81-
case tref: TypeRef =>
82-
val cls = tref.classSymbol.asClass
83-
// local class may capture, thus we need to track it
84-
if (tref.prefix == NoPrefix) {
85-
val enclosingCls = cls.enclosingClass.asClass
86-
val thisRef = ThisRef(enclosingCls)(expr)
87-
Summary.empty + Warm(cls, thisRef)(expr)
88-
}
89-
else {
90-
val (pots, effs) = analyze(tref.prefix, expr)
91-
if (pots.isEmpty) Summary.empty.withEffs(effs)
92-
else {
93-
assert(pots.size == 1)
94-
(Warm(cls, pots.head)(expr).toPots, effs)
95-
}
96-
}
80+
def typeRefOf(tp: Type): TypeRef = tp.typeConstructor match {
81+
case tref: TypeRef => tref
82+
case hklambda: HKTypeLambda => typeRefOf(hklambda.resType)
83+
}
84+
85+
val tref = typeRefOf(tpt.tpe)
86+
val cls = tref.classSymbol.asClass
87+
// local class may capture, thus we need to track it
88+
if (tref.prefix == NoPrefix) {
89+
val enclosingCls = cls.enclosingClass.asClass
90+
val thisRef = ThisRef(enclosingCls)(expr)
91+
Summary.empty + Warm(cls, thisRef)(expr)
92+
}
93+
else {
94+
val (pots, effs) = analyze(tref.prefix, expr)
95+
if (pots.isEmpty) Summary.empty.withEffs(effs)
96+
else {
97+
assert(pots.size == 1)
98+
(Warm(cls, pots.head)(expr).toPots, effs)
99+
}
97100
}
98101

99102
case Typed(expr, tpt) =>

0 commit comments

Comments
 (0)