Skip to content

Commit aab14e9

Browse files
committed
Rename notInitialized to uninitialized
1 parent 4cfe697 commit aab14e9

File tree

8 files changed

+25
-25
lines changed

8 files changed

+25
-25
lines changed

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,13 @@ class Definitions {
225225

226226
@tu lazy val CompiletimePackageObject: Symbol = requiredModule("scala.compiletime.package")
227227
@tu lazy val Compiletime_codeOf: Symbol = CompiletimePackageObject.requiredMethod("codeOf")
228-
@tu lazy val Compiletime_erasedValue : Symbol = CompiletimePackageObject.requiredMethod("erasedValue")
229-
@tu lazy val Compiletime_notInitialized: Symbol = CompiletimePackageObject.requiredMethod("notInitialized")
230-
@tu lazy val Compiletime_error : Symbol = CompiletimePackageObject.requiredMethod(nme.error)
231-
@tu lazy val Compiletime_requireConst : Symbol = CompiletimePackageObject.requiredMethod("requireConst")
232-
@tu lazy val Compiletime_constValue : Symbol = CompiletimePackageObject.requiredMethod("constValue")
233-
@tu lazy val Compiletime_constValueOpt : Symbol = CompiletimePackageObject.requiredMethod("constValueOpt")
234-
@tu lazy val Compiletime_summonFrom : Symbol = CompiletimePackageObject.requiredMethod("summonFrom")
228+
@tu lazy val Compiletime_erasedValue : Symbol = CompiletimePackageObject.requiredMethod("erasedValue")
229+
@tu lazy val Compiletime_uninitialized: Symbol = CompiletimePackageObject.requiredMethod("uninitialized")
230+
@tu lazy val Compiletime_error : Symbol = CompiletimePackageObject.requiredMethod(nme.error)
231+
@tu lazy val Compiletime_requireConst : Symbol = CompiletimePackageObject.requiredMethod("requireConst")
232+
@tu lazy val Compiletime_constValue : Symbol = CompiletimePackageObject.requiredMethod("constValue")
233+
@tu lazy val Compiletime_constValueOpt: Symbol = CompiletimePackageObject.requiredMethod("constValueOpt")
234+
@tu lazy val Compiletime_summonFrom : Symbol = CompiletimePackageObject.requiredMethod("summonFrom")
235235
@tu lazy val CompiletimeTestingPackage: Symbol = requiredPackage("scala.compiletime.testing")
236236
@tu lazy val CompiletimeTesting_typeChecks: Symbol = CompiletimeTestingPackage.requiredMethod("typeChecks")
237237
@tu lazy val CompiletimeTesting_typeCheckErrors: Symbol = CompiletimeTestingPackage.requiredMethod("typeCheckErrors")

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,8 +3218,8 @@ object Parsers {
32183218
&& !tpt.isEmpty && mods.is(Mutable) && lhs.forall(_.isInstanceOf[Ident]) =>
32193219
if sourceVersion.isAtLeast(`3.1`) then
32203220
deprecationWarning(
3221-
em"""`= _` has been deprecated; use `= notInitialized` instead.
3222-
|`notInitialized` needs to be imported from scala.compiletime.""", rhsOffset)
3221+
em"""`= _` has been deprecated; use `= uninitialized` instead.
3222+
|`uninitialized` needs to be imported from scala.compiletime.""", rhsOffset)
32233223
placeholderParams = placeholderParams.tail
32243224
atSpan(rhs0.span) { Ident(nme.WILDCARD) }
32253225
case rhs0 => rhs0

compiler/src/dotty/tools/dotc/transform/PruneErasedDefs.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import ast.tpd
1919
* The phase also replaces all expressions that appear in an erased context by
2020
* default values. This is necessary so that subsequent checking phases such
2121
* as IsInstanceOfChecker don't give false negatives.
22-
* Finally, the phase replaces `compiletime.notInitialized` on the right hand side
22+
* Finally, the phase replaces `compiletime.uninitialized` on the right hand side
2323
* of a mutable field definition by `_`. This avoids a "is declared erased, but is
2424
* in fact used" error in Erasure and communicates to Constructors that the
2525
* variable does not have an initializer.
@@ -49,7 +49,7 @@ class PruneErasedDefs extends MiniPhase with SymTransformer { thisTransform =>
4949
cpy.ValDef(tree)(rhs = trivialErasedTree(tree))
5050
else tree.rhs match
5151
case rhs: TypeApply
52-
if rhs.symbol == defn.Compiletime_notInitialized
52+
if rhs.symbol == defn.Compiletime_uninitialized
5353
&& sym.is(Mutable) && sym.owner.isClass =>
5454
cpy.ValDef(tree)(rhs = cpy.Ident(rhs)(nme.WILDCARD))
5555
case _ =>

docs/docs/reference/dropped-features/wildcard-init.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ The syntax
88
var x: A = _
99
```
1010
that was used to indicate an uninitialized field has been dropped.
11-
At its place there is a special value `notInitialized` in the `scala.compiletime` package. To get an uninitialized field, you now write
11+
At its place there is a special value `uninitialized` in the `scala.compiletime` package. To get an uninitialized field, you now write
1212
```scala
13-
import scala.compiletime.notInitialized
13+
import scala.compiletime.uninitialized
1414

15-
var x: A = notInitialized
15+
var x: A = uninitialized
1616
```
1717
To enable cross-compilation, `_` is still supported, but it will be dropped in a future 3.x version.
1818

library/src/scala/compiletime/package.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ package object compiletime {
1616
*/
1717
erased def erasedValue[T]: T = ???
1818

19-
/** Used as the initializer of a class or object field, like this:
19+
/** Used as the initializer of a mutable class or object field, like this:
2020
*
21-
* val x: T = notInitialized
21+
* var x: T = uninitialized
2222
*
23-
* This signifies that the field is not initialized by its own (On the JVM
23+
* This signifies that the field is not initialized on its own (On the JVM
2424
* it is still bulk-initialized to a zero bitfield).
2525
*/
26-
erased def notInitialized[T]: T = ???
26+
erased def uninitialized[T]: T = ???
2727

2828
/** The error method is used to produce user-defined compile errors during inline expansion.
2929
* If an inline expansion results in a call error(msgStr) the compiler produces an error message containing the given msgStr.

tests/neg-strict/i11225.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import compiletime.notInitialized
1+
import compiletime.uninitialized
22

33
class Memo[A](x: => A):
44
private var cached: A = _ // error

tests/neg/i11225.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import compiletime.notInitialized
1+
import compiletime.uninitialized
22

33
@main def Test(x: Boolean) =
4-
var cached: Int = notInitialized // error
5-
cached = if x then 1 else notInitialized // error
4+
var cached: Int = uninitialized // error
5+
cached = if x then 1 else uninitialized // error

tests/pos/i11225.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import compiletime.notInitialized
1+
import compiletime.uninitialized
22

33
class Memo[A](x: => A):
4-
private var cached1: A = notInitialized
5-
private var cached: A = notInitialized
4+
private var cached1: A = uninitialized
5+
private var cached: A = uninitialized
66
private var known: Boolean = false
77
def force =
88
if !known then

0 commit comments

Comments
 (0)