Skip to content

Commit a01ad4b

Browse files
committed
Do not patch stdlib when compilingwith -Yscala2-stdlib
1 parent a3c9f10 commit a01ad4b

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,9 @@ class Definitions {
13691369
denot.sourceModule.info = denot.typeRef // we run into a cyclic reference when patching if this line is omitted
13701370
patch2(denot, patchCls)
13711371

1372-
if denot.name == tpnme.Predef.moduleClassName && denot.symbol == ScalaPredefModuleClass then
1372+
if ctx.settings.Yscala2Stdlib.value then
1373+
()
1374+
else if denot.name == tpnme.Predef.moduleClassName && denot.symbol == ScalaPredefModuleClass then
13731375
patchWith(ScalaPredefModuleClassPatch)
13741376
else if denot.name == tpnme.language.moduleClassName && denot.symbol == LanguageModuleClass then
13751377
patchWith(LanguageModuleClassPatch)

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -574,16 +574,11 @@ object TreeChecker {
574574

575575
val symbolsNotDefined = (decls -- defined - constr.symbol).filterNot(isAllowed)
576576

577-
def isScala2LibBootstrappedIssue =
578-
// TODO remove the need for this workaround
579-
// Patched members should be added to they class to they definitions
580-
ctx.settings.Yscala2Stdlib.value && (
581-
cls == defn.ScalaPredefModuleClass // scala.runtime.stdLibPatches.Predef
582-
|| defn.isTupleClass(cls) // specialized members
583-
|| cls.ownersIterator.contains(defn.LanguageModuleClass) // duplications?
584-
)
577+
def isStdlibBootstrappedIssue =
578+
// FIXME: specialized members of TupleN are failing. These should not exist.
579+
ctx.settings.Yscala2Stdlib.value && defn.isTupleClass(cls)
585580

586-
assert(symbolsNotDefined.isEmpty || isScala2LibBootstrappedIssue,
581+
assert(symbolsNotDefined.isEmpty || isStdlibBootstrappedIssue,
587582
i" $cls tree does not define members: ${symbolsNotDefined.toList}%, %\n" +
588583
i"expected: ${decls.toList}%, %\n" +
589584
i"defined: ${defined}%, %")

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ class YCheckPositions extends Phase {
2525
val checker = new TreeTraverser {
2626
private var sources: List[SourceFile] = ctx.source :: Nil
2727
def traverse(tree: tpd.Tree)(using Context): Unit = {
28-
if ctx.settings.Yscala2Stdlib.value && tree.source.toString == "library/src/scala/runtime/stdLibPatches/Predef.scala" then
29-
return // FIXME: there is a conflict between the sources of scala.Predef and scala.runtime.stdLibPatches.Predef
3028

3129
// Check current context is correct
3230
assert(ctx.source == sources.head)

0 commit comments

Comments
 (0)