@@ -1369,7 +1369,9 @@ class Definitions {
1369
1369
denot.sourceModule.info = denot.typeRef // we run into a cyclic reference when patching if this line is omitted
1370
1370
patch2(denot, patchCls)
1371
1371
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
1373
1375
patchWith(ScalaPredefModuleClassPatch )
1374
1376
else if denot.name == tpnme.language.moduleClassName && denot.symbol == LanguageModuleClass then
1375
1377
patchWith(LanguageModuleClassPatch )
@@ -1724,8 +1726,9 @@ class Definitions {
1724
1726
isFunctionType(tp) || isRefinedFunctionType(tp)
1725
1727
1726
1728
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)))
1729
1732
cls
1730
1733
1731
1734
@ tu lazy val Tuple1 : ClassSymbol = withSpecMethods(requiredClass(" scala.Tuple1" ), List (nme._1), Tuple1SpecializedParamTypes )
@@ -1766,6 +1769,7 @@ class Definitions {
1766
1769
case List (x, y) => Tuple2SpecializedParamClasses ().contains(x.classSymbol) && Tuple2SpecializedParamClasses ().contains(y.classSymbol)
1767
1770
case _ => false
1768
1771
&& 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
1769
1773
1770
1774
def isSpecializableFunction (cls : ClassSymbol , paramTypes : List [Type ], retType : Type )(using Context ): Boolean =
1771
1775
paramTypes.length <= 2
@@ -1787,6 +1791,7 @@ class Definitions {
1787
1791
case _ =>
1788
1792
false
1789
1793
})
1794
+ && ! ctx.settings.Yscala2Stdlib .value // We do not add the specilized FunctionN methods/classes when compiling the stdlib
1790
1795
1791
1796
@ tu lazy val Function0SpecializedApplyNames : collection.Set [TermName ] =
1792
1797
for r <- Function0SpecializedReturnTypes
0 commit comments