Skip to content

Commit 07703dd

Browse files
committed
Even more careful handling of tailcalls.
See i321 doc for description of problem and decision taken.
1 parent cbf6f98 commit 07703dd

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/dotty/tools/dotc/transform/TailRec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete
183183

184184
val recvWiden = recv.tpe.widenDealias
185185

186-
val receiverIsSame = recvWiden isRef enclosingClass
186+
val receiverIsSame = enclosingClass.typeRef.widenDealias =:= recvWiden
187187
val receiverIsSuper = (method.name eq sym) && enclosingClass.typeRef.widen <:< recvWiden
188188
val receiverIsThis = recv.tpe =:= thisType
189189

tests/pos/tailcall/i321.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class i321[T >: Null <: AnyRef] {
2121
loop(null)
2222
}
2323

24-
@tailrec
2524
final def go2[U >: Null <: AnyRef](t: i321[U]): Int = t.go2(this)
2625

2726
}

0 commit comments

Comments
 (0)