Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/config/Printers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ object Printers {
val plugins: Printer = noPrinter
val simplify: Printer = noPrinter
val subtyping: Printer = noPrinter
val tailrec: Printer = noPrinter
val transforms: Printer = noPrinter
val typr: Printer = noPrinter
val unapp: Printer = noPrinter
Expand Down
18 changes: 10 additions & 8 deletions compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1801,14 +1801,16 @@ object messages {
case class TailrecNotApplicable(symbol: Symbol)(implicit ctx: Context)
extends Message(TailrecNotApplicableID) {
val kind: String = "Syntax"
val symbolKind: String = symbol.showKind
val msg: String =
if (symbol.is(Method))
hl"TailRec optimisation not applicable, $symbol is neither ${"private"} nor ${"final"}."
else
hl"TailRec optimisation not applicable, ${symbolKind} isn't a method."
val explanation: String =
hl"A method annotated ${"@tailrec"} must be declared ${"private"} or ${"final"} so it can't be overridden."
val msg: String = {
val reason =
if (!symbol.is(Method)) hl"$symbol isn't a method"
else if (symbol.is(Deferred)) hl"$symbol is abstract"
else if (!symbol.isEffectivelyFinal) hl"$symbol is neither ${"private"} nor ${"final"} so can be overridden"
else hl"$symbol contains no recursive calls"

s"TailRec optimisation not applicable, $reason"
}
val explanation: String = ""
}

case class FailureToEliminateExistential(tp: Type, tp1: Type, tp2: Type, boundSyms: List[Symbol])(implicit ctx: Context)
Expand Down
Loading