Skip to content

Commit ac46e2b

Browse files
committed
1 parent d7994ed commit ac46e2b

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package ast
44

55
import core.*
66
import util.Spans.*, Types.*, Contexts.*, Constants.*, Names.*, NameOps.*, Flags.*
7-
import Symbols.*, StdNames.*, Trees.*, ContextOps.*
7+
import Symbols.*, StdNames.*, Definitions.*, Trees.*, ContextOps.*
88
import Decorators.*
99
import Annotations.Annotation
1010
import NameKinds.{UniqueName, ContextBoundParamName, ContextFunctionParamName, DefaultGetterName, WildcardParamName}
@@ -1024,7 +1024,12 @@ object desugar {
10241024
val toStringMeth =
10251025
DefDef(nme.toString_, Nil, TypeTree(), Literal(Constant(className.toString))).withMods(Modifiers(Override | Synthetic))
10261026

1027-
companionDefs(anyRef, applyMeths ::: unapplyMeth :: toStringMeth :: companionMembers)
1027+
if Feature.shouldBehaveAsScala2 && !mods.is(Abstract) && originalTparams.isEmpty && arity <= MaxImplementedFunctionArity then
1028+
val tpt = originalVparamss.head.map(_.tpt) :+ untpd.Ident(cdef.name)
1029+
val parent = appliedTypeTree(scalaRuntimeDot(s"AbstractFunction$arity".toTypeName), tpt)
1030+
companionDefs(parent, applyMeths ::: unapplyMeth :: toStringMeth :: companionMembers)
1031+
else
1032+
companionDefs(anyRef, applyMeths ::: unapplyMeth :: toStringMeth :: companionMembers)
10281033
}
10291034
else if (companionMembers.nonEmpty || companionDerived.nonEmpty || isEnum)
10301035
companionDefs(anyRef, companionMembers)

project/MiMaFilters.scala

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -548,17 +548,6 @@ object MiMaFilters {
548548
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.runtime.Tuple3Zipped.coll2$extension"),
549549
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.runtime.Tuple3Zipped.coll3$extension"),
550550

551-
// singleton case classes modules inherit AbstractFunction1??
552-
ProblemFilters.exclude[MissingTypesProblem]("scala.ScalaReflectionException$"),
553-
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.ScalaReflectionException.compose"),
554-
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.ScalaReflectionException.andThen"),
555-
ProblemFilters.exclude[MissingTypesProblem]("scala.UninitializedFieldError$"),
556-
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.UninitializedFieldError.compose"),
557-
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.UninitializedFieldError.andThen"),
558-
ProblemFilters.exclude[MissingTypesProblem]("scala.collection.StringView$"),
559-
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.StringView.compose"),
560-
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.StringView.andThen"),
561-
562551
// TO INVESTIGATE: This constructor changed, but it is private... why complaining?
563552
ProblemFilters.exclude[IncompatibleMethTypeProblem]("scala.collection.immutable.LazyList.this"),
564553
// This one should be fine, public class inside private object

0 commit comments

Comments
 (0)