Skip to content

Commit

Permalink
Refine error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
liufengyun committed Jan 28, 2020
1 parent b53c63c commit 22d853d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler/src/dotty/tools/dotc/transform/init/Errors.scala
Expand Up @@ -67,19 +67,19 @@ object Errors {

/** Promote `this` under initialization to fully-initialized */
case class PromoteThis(pot: ThisRef, source: Tree, trace: Vector[Tree]) extends Error {
def show(implicit ctx: Context): String = "Promote the value under initialization to be initialized."
def show(implicit ctx: Context): String = "Promote the value under initialization to fully-initialized."
}

/** Promote `this` under initialization to fully-initialized */
case class PromoteWarm(pot: Warm, source: Tree, trace: Vector[Tree]) extends Error {
def show(implicit ctx: Context): String =
"Promoting the value under initialization to be initialized."
"Promoting the value under initialization to fully-initialized."
}

/** Promote a cold value under initialization to fully-initialized */
case class PromoteCold(source: Tree, trace: Vector[Tree]) extends Error {
def show(implicit ctx: Context): String =
"Promoting the value " + source.show + " to be initialized while it is under initialization" + "."
"Promoting the value " + source.show + " to fully-initialized while it is under initialization" + "."
}

case class AccessCold(field: Symbol, source: Tree, trace: Vector[Tree]) extends Error {
Expand All @@ -105,7 +105,7 @@ object Errors {

def show(implicit ctx: Context): String = {
var index = 0
"Promoting the value to initialized is unsafe.\n" + stacktrace +
"Promoting the value to fully-initialized is unsafe.\n" + stacktrace +
"\nThe unsafe promotion may cause the following problem(s):\n" +
(errors.flatMap(_.flatten).map { error =>
index += 1
Expand Down

0 comments on commit 22d853d

Please sign in to comment.