@@ -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 )
@@ -1724,8 +1726,9 @@ class Definitions {
17241726 isFunctionType(tp) || isRefinedFunctionType(tp)
17251727
17261728 private def withSpecMethods (cls : ClassSymbol , bases : List [Name ], paramTypes : Set [TypeRef ]) =
1727- for base <- bases; tp <- paramTypes do
1728- 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)))
17291732 cls
17301733
17311734 @ tu lazy val Tuple1 : ClassSymbol = withSpecMethods(requiredClass(" scala.Tuple1" ), List (nme._1), Tuple1SpecializedParamTypes )
@@ -1766,6 +1769,7 @@ class Definitions {
17661769 case List (x, y) => Tuple2SpecializedParamClasses ().contains(x.classSymbol) && Tuple2SpecializedParamClasses ().contains(y.classSymbol)
17671770 case _ => false
17681771 && 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
17691773
17701774 def isSpecializableFunction (cls : ClassSymbol , paramTypes : List [Type ], retType : Type )(using Context ): Boolean =
17711775 paramTypes.length <= 2
@@ -1787,6 +1791,7 @@ class Definitions {
17871791 case _ =>
17881792 false
17891793 })
1794+ && ! ctx.settings.Yscala2Stdlib .value // We do not add the specilized FunctionN methods/classes when compiling the stdlib
17901795
17911796 @ tu lazy val Function0SpecializedApplyNames : collection.Set [TermName ] =
17921797 for r <- Function0SpecializedReturnTypes
0 commit comments