diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/transform/TailRec.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/TailRec.scala b/src/dotty/tools/dotc/transform/TailRec.scala index d99a48af3..fde4db811 100644 --- a/src/dotty/tools/dotc/transform/TailRec.scala +++ b/src/dotty/tools/dotc/transform/TailRec.scala @@ -143,7 +143,11 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete newOwners = label :: Nil ).transform(rhsSemiTransformed) }) - Block(List(labelDef), ref(label).appliedToArgss(vparamss0.map(_.map(x=> ref(x.symbol))))) + val callIntoLabel = ( + if (dd.tparams.isEmpty) ref(label) + else ref(label).appliedToTypes(dd.tparams.map(_.tpe)) + ).appliedToArgss(vparamss0.map(_.map(x=> ref(x.symbol)))) + Block(List(labelDef), callIntoLabel) }} else { if (mandatory) ctx.error( "TailRec optimisation not applicable, method not tail recursive", |