Skip to content

Commit f69d90d

Browse files
committed
Remove DottyPredef
1 parent f334e3f commit f69d90d

File tree

6 files changed

+8
-22
lines changed

6 files changed

+8
-22
lines changed

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

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -507,17 +507,6 @@ class Definitions {
507507
def staticsMethodRef(name: PreName): TermRef = ScalaStaticsModule.requiredMethodRef(name)
508508
def staticsMethod(name: PreName): TermSymbol = ScalaStaticsModule.requiredMethod(name)
509509

510-
// Dotty deviation: we cannot use a @tu lazy val here because @tu lazy vals in dotty
511-
// will return "null" when called recursively, see #1856.
512-
def DottyPredefModule: Symbol = {
513-
if (myDottyPredefModule == null) {
514-
myDottyPredefModule = getModuleIfDefined("dotty.DottyPredef")
515-
assert(myDottyPredefModule != null)
516-
}
517-
myDottyPredefModule
518-
}
519-
private var myDottyPredefModule: Symbol = _
520-
521510
@tu lazy val DottyArraysModule: Symbol = requiredModule("scala.runtime.Arrays")
522511
def newGenericArrayMethod(using Context): TermSymbol = DottyArraysModule.requiredMethod("newGenericArray")
523512
def newArrayMethod(using Context): TermSymbol = DottyArraysModule.requiredMethod("newArray")
@@ -1351,10 +1340,8 @@ class Definitions {
13511340
JavaImportFns :+
13521341
RootRef(() => ScalaPackageVal.termRef)
13531342

1354-
private val PredefImportFns: List[RootRef] = List(
1355-
RootRef(() => ScalaPredefModule.termRef, isPredef=true),
1356-
RootRef(() => DottyPredefModule.termRef)
1357-
)
1343+
private val PredefImportFns: RootRef =
1344+
RootRef(() => ScalaPredefModule.termRef, isPredef=true)
13581345

13591346
@tu private lazy val JavaRootImportFns: List[RootRef] =
13601347
if ctx.settings.YnoImports.value then Nil
@@ -1363,7 +1350,7 @@ class Definitions {
13631350
@tu private lazy val ScalaRootImportFns: List[RootRef] =
13641351
if ctx.settings.YnoImports.value then Nil
13651352
else if ctx.settings.YnoPredef.value then ScalaImportFns
1366-
else ScalaImportFns ++ PredefImportFns
1353+
else ScalaImportFns :+ PredefImportFns
13671354

13681355
@tu private lazy val JavaRootImportTypes: List[TermRef] = JavaRootImportFns.map(_.refFn())
13691356
@tu private lazy val ScalaRootImportTypes: List[TermRef] = ScalaRootImportFns.map(_.refFn())
@@ -1395,7 +1382,7 @@ class Definitions {
13951382
else ScalaUnqualifiedOwnerTypes
13961383

13971384
/** Names of the root import symbols that can be hidden by other imports */
1398-
@tu lazy val ShadowableImportNames: Set[TermName] = Set("Predef", "DottyPredef").map(_.toTermName)
1385+
@tu lazy val ShadowableImportNames: Set[TermName] = Set("Predef".toTermName)
13991386

14001387
/** Class symbols for which no class exist at runtime */
14011388
@tu lazy val NotRuntimeClasses: Set[Symbol] = Set(AnyClass, AnyValClass, NullClass, NothingClass)

compiler/src/dotty/tools/dotc/typer/ImportInfo.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ object ImportInfo {
5151
* @param symNameOpt Optionally, the name of the import symbol. None for root imports.
5252
* Defined for all explicit imports from ident or select nodes.
5353
* @param isRootImport true if this is one of the implicit imports of scala, java.lang,
54-
* scala.Predef or dotty.DottyPredef in the start context, false otherwise.
54+
* scala.Predef in the start context, false otherwise.
5555
*/
5656
class ImportInfo(symf: Context ?=> Symbol,
5757
val selectors: List[untpd.ImportSelector],

language-server/test/dotty/tools/languageserver/CompletionTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CompletionTest {
2323
))
2424
}
2525

26-
@Test def completionFromDottyPredef: Unit = {
26+
@Test def completionFromNewScalaPredef: Unit = {
2727
code"class Foo { val foo = summ${m1} }".withSource
2828
.completion(m1, Set(("summon", Method, "[T](using x: T): x.type")))
2929
}

tests/neg/nopredef.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Predef.{assert => _}
2-
import dotty.DottyPredef.{assert => _}
32

43
object Test {
54
assert("asdf" == "asdf") // error: not found assert

tests/pos/depfuntype.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object Test {
1616
val z = depfun3(d)
1717
val z1: d.M = z
1818

19-
// Reproduced here because the one from DottyPredef is lacking a parameter dependency of the return type `ev.type`
19+
// Reproduced here because the one from Predef is lacking a parameter dependency of the return type `ev.type`
2020
inline final def implicitly[T](implicit ev: T): ev.type = ev
2121

2222
type IDF = (x: C) ?=> x.M

tests/pos/i6384.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ type ManualLambda[a] = Tc1[a] & Tc2[a]
1111
object app extends App {
1212
implicitly[Tc1[X]] //ok
1313
implicitly[ManualLambda[X]] // ok
14-
implicitly[Tc1[X] & Tc2[X]] // no implicit argument of type Tc1[X] & Tc2[X] was found for parameter ev of method implicitly in object DottyPredef
14+
implicitly[Tc1[X] & Tc2[X]] // no implicit argument of type Tc1[X] & Tc2[X] was found for parameter ev of method implicitly in object Predef
1515
}

0 commit comments

Comments
 (0)