diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-09-29 17:10:45 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-10-10 13:25:36 +0200 |
commit | f23ff3abba8663a0e7f64f79b556efd36cc86a83 (patch) | |
tree | d025c7362cd14bae1ac54b02d399554e3b91c12c /src/dotty/tools/dotc/transform/TailRec.scala | |
parent | 0781b31fa4e3d22cb6a51882b8d632ea9a16ed6f (diff) | |
download | dotty-f23ff3abba8663a0e7f64f79b556efd36cc86a83.tar.gz dotty-f23ff3abba8663a0e7f64f79b556efd36cc86a83.tar.bz2 dotty-f23ff3abba8663a0e7f64f79b556efd36cc86a83.zip |
Improve positions for MemberDefs using `namePos`
Diffstat (limited to 'src/dotty/tools/dotc/transform/TailRec.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/TailRec.scala | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/transform/TailRec.scala b/src/dotty/tools/dotc/transform/TailRec.scala index b345dda61..065bcb397 100644 --- a/src/dotty/tools/dotc/transform/TailRec.scala +++ b/src/dotty/tools/dotc/transform/TailRec.scala @@ -145,17 +145,22 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete }) Block(List(labelDef), ref(label).appliedToArgss(vparamss0.map(_.map(x=> ref(x.symbol))))) }} else { - if (mandatory) - ctx.error("TailRec optimisation not applicable, method not tail recursive", dd.pos) + if (mandatory) ctx.error( + "TailRec optimisation not applicable, method not tail recursive", + // FIXME: want to report this error on `dd.namePos`, but + // because of extension method getting a weird pos, it is + // better to report on symbol so there's no overlap + sym.pos + ) dd.rhs } }) } case d: DefDef if d.symbol.hasAnnotation(defn.TailrecAnnot) || methodsWithInnerAnnots.contains(d.symbol) => - ctx.error("TailRec optimisation not applicable, method is neither private nor final so can be overridden", d.pos) + ctx.error("TailRec optimisation not applicable, method is neither private nor final so can be overridden", sym.pos) d case d if d.symbol.hasAnnotation(defn.TailrecAnnot) || methodsWithInnerAnnots.contains(d.symbol) => - ctx.error("TailRec optimisation not applicable, not a method", d.pos) + ctx.error("TailRec optimisation not applicable, not a method", sym.pos) d case _ => tree } |