Skip to content

Commit b3045ca

Browse files
committed
Do not patch Tuple1/Tuple2 with specialized methods
1 parent a01ad4b commit b3045ca

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,8 +1726,9 @@ class Definitions {
17261726
isFunctionType(tp) || isRefinedFunctionType(tp)
17271727

17281728
private def withSpecMethods(cls: ClassSymbol, bases: List[Name], paramTypes: Set[TypeRef]) =
1729-
for base <- bases; tp <- paramTypes do
1730-
cls.enter(newSymbol(cls, base.specializedName(List(tp)), Method, ExprType(tp)))
1729+
if !ctx.settings.Yscala2Stdlib.value then
1730+
for base <- bases; tp <- paramTypes do
1731+
cls.enter(newSymbol(cls, base.specializedName(List(tp)), Method, ExprType(tp)))
17311732
cls
17321733

17331734
@tu lazy val Tuple1: ClassSymbol = withSpecMethods(requiredClass("scala.Tuple1"), List(nme._1), Tuple1SpecializedParamTypes)
@@ -1768,6 +1769,7 @@ class Definitions {
17681769
case List(x, y) => Tuple2SpecializedParamClasses().contains(x.classSymbol) && Tuple2SpecializedParamClasses().contains(y.classSymbol)
17691770
case _ => false
17701771
&& base.owner.denot.info.member(base.name.specializedName(args)).exists // when dotc compiles the stdlib there are no specialised classes
1772+
&& !ctx.settings.Yscala2Stdlib.value // We do not add the specilized TupleN methods/classes when compiling the stdlib
17711773

17721774
def isSpecializableFunction(cls: ClassSymbol, paramTypes: List[Type], retType: Type)(using Context): Boolean =
17731775
paramTypes.length <= 2

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -574,11 +574,7 @@ object TreeChecker {
574574

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

577-
def isStdlibBootstrappedIssue =
578-
// FIXME: specialized members of TupleN are failing. These should not exist.
579-
ctx.settings.Yscala2Stdlib.value && defn.isTupleClass(cls)
580-
581-
assert(symbolsNotDefined.isEmpty || isStdlibBootstrappedIssue,
577+
assert(symbolsNotDefined.isEmpty,
582578
i" $cls tree does not define members: ${symbolsNotDefined.toList}%, %\n" +
583579
i"expected: ${decls.toList}%, %\n" +
584580
i"defined: ${defined}%, %")

0 commit comments

Comments
 (0)