diff --git a/compiler/src/dotty/tools/dotc/transform/init/Semantic.scala b/compiler/src/dotty/tools/dotc/transform/init/Semantic.scala index 7e72e35089c6..25ea09c3ade4 100644 --- a/compiler/src/dotty/tools/dotc/transform/init/Semantic.scala +++ b/compiler/src/dotty/tools/dotc/transform/init/Semantic.scala @@ -1234,9 +1234,9 @@ object Semantic { case SeqLiteral(elems, elemtpt) => val ress = elems.map { elem => - eval(elem, thisV, klass).ensureHot("May only use initialized value as method arguments", elem) + eval(elem, thisV, klass) } - Result(Hot, ress.flatMap(_.errors)) + Result(ress.map(_.value).join, ress.flatMap(_.errors)) case Inlined(call, bindings, expansion) => val trace1 = trace.add(expr) diff --git a/tests/init/neg/enum-desugared.check b/tests/init/neg/enum-desugared.check index dfea2038d0e6..3deb11a7f311 100644 --- a/tests/init/neg/enum-desugared.check +++ b/tests/init/neg/enum-desugared.check @@ -1,22 +1,11 @@ --- Error: tests/init/neg/enum-desugared.scala:17:15 -------------------------------------------------------------------- -17 | Array(this.LazyErrorId, this.NoExplanationID) // error // error - | ^^^^^^^^^^^^^^^^ - | Cannot prove that the value is fully initialized. May only use initialized value as method arguments. +-- Error: tests/init/neg/enum-desugared.scala:17:10 -------------------------------------------------------------------- +17 | Array(this.LazyErrorId, this.NoExplanationID) // error + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | Cannot prove that the value is fully initialized. Only initialized values may be used as arguments. | | The unsafe promotion may cause the following problem: | Calling the external method method name may cause initialization errors. Calling trace: - | -> Array(this.LazyErrorId, this.NoExplanationID) // error // error [ enum-desugared.scala:17 ] - | ^^^^^^^^^^^^^^^^ + | -> Array(this.LazyErrorId, this.NoExplanationID) // error [ enum-desugared.scala:17 ] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -> override def productPrefix: String = this.name() [ enum-desugared.scala:29 ] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- Error: tests/init/neg/enum-desugared.scala:17:33 -------------------------------------------------------------------- -17 | Array(this.LazyErrorId, this.NoExplanationID) // error // error - | ^^^^^^^^^^^^^^^^^^^^ - | Cannot prove that the value is fully initialized. May only use initialized value as method arguments. - | - | The unsafe promotion may cause the following problem: - | Calling the external method method ordinal may cause initialization errors. Calling trace: - | -> Array(this.LazyErrorId, this.NoExplanationID) // error // error [ enum-desugared.scala:17 ] - | ^^^^^^^^^^^^^^^^^^^^ - | -> def errorNumber: Int = this.ordinal() - 2 [ enum-desugared.scala:8 ] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/init/neg/enum-desugared.scala b/tests/init/neg/enum-desugared.scala index eb80f112a06c..8c1f3662f926 100644 --- a/tests/init/neg/enum-desugared.scala +++ b/tests/init/neg/enum-desugared.scala @@ -14,7 +14,7 @@ object ErrorMessageID { final val NoExplanationID = $new(1, "NoExplanationID") private[this] val $values: Array[ErrorMessageID] = - Array(this.LazyErrorId, this.NoExplanationID) // error // error + Array(this.LazyErrorId, this.NoExplanationID) // error def values: Array[ErrorMessageID] = $values.clone() diff --git a/tests/init/neg/enum.check b/tests/init/neg/enum.check index 08c69e9bc246..655d9b74e863 100644 --- a/tests/init/neg/enum.check +++ b/tests/init/neg/enum.check @@ -1,7 +1,7 @@ -- Error: tests/init/neg/enum.scala:4:8 -------------------------------------------------------------------------------- 4 | NoExplanationID // error | ^ - | Cannot prove that the value is fully initialized. May only use initialized value as method arguments. + | Cannot prove that the value is fully initialized. Only initialized values may be used as arguments. | | The unsafe promotion may cause the following problem: | Calling the external method method name may cause initialization errors. Calling trace: diff --git a/tests/init/neg/leak-warm.check b/tests/init/neg/leak-warm.check index 8219283b3c16..7eac95bf8de7 100644 --- a/tests/init/neg/leak-warm.check +++ b/tests/init/neg/leak-warm.check @@ -1,8 +1,4 @@ -- Error: tests/init/neg/leak-warm.scala:18:26 ------------------------------------------------------------------------- -18 | val l: List[A] = List(c, d) // error // error - | ^ - | Cannot prove that the value is fully initialized. May only use initialized value as method arguments. --- Error: tests/init/neg/leak-warm.scala:18:29 ------------------------------------------------------------------------- -18 | val l: List[A] = List(c, d) // error // error - | ^ - | Cannot prove that the value is fully initialized. May only use initialized value as method arguments. +18 | val l: List[A] = List(c, d) // error + | ^^^^ + | Cannot prove that the value is fully initialized. Only initialized values may be used as arguments. diff --git a/tests/init/neg/leak-warm.scala b/tests/init/neg/leak-warm.scala index f562ab4ec416..f12b22dce8d9 100644 --- a/tests/init/neg/leak-warm.scala +++ b/tests/init/neg/leak-warm.scala @@ -15,6 +15,6 @@ object leakWarm { } val c = new C(1, 2) val d = new D(3, 4) - val l: List[A] = List(c, d) // error // error + val l: List[A] = List(c, d) // error val l2 = l.map(_.m()) }