Skip to content

Commit f125fe9

Browse files
Merge pull request #10416 from dotty-staging/fix-#10411
Remove TupledFunction for 3.0
2 parents d348877 + f4e1ca4 commit f125fe9

21 files changed

+0
-315
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -894,10 +894,6 @@ class Definitions {
894894
lazy val RuntimeTuple_isInstanceOfEmptyTuple: Symbol = RuntimeTupleModule.requiredMethod("isInstanceOfEmptyTuple")
895895
lazy val RuntimeTuple_isInstanceOfNonEmptyTuple: Symbol = RuntimeTupleModule.requiredMethod("isInstanceOfNonEmptyTuple")
896896

897-
@tu lazy val TupledFunctionTypeRef: TypeRef = requiredClassRef("scala.util.TupledFunction")
898-
def TupledFunctionClass(using Context): ClassSymbol = TupledFunctionTypeRef.symbol.asClass
899-
def RuntimeTupleFunctionsModule(using Context): Symbol = requiredModule("scala.runtime.TupledFunctions")
900-
901897
// Annotation base classes
902898
@tu lazy val AnnotationClass: ClassSymbol = requiredClass("scala.annotation.Annotation")
903899
@tu lazy val ClassfileAnnotationClass: ClassSymbol = requiredClass("scala.annotation.ClassfileAnnotation")

compiler/src/dotty/tools/dotc/typer/Synthesizer.scala

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -77,50 +77,6 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
7777
}
7878
end synthesizedTypeTest
7979

80-
val synthesizedTupleFunction: SpecialHandler = (formal, span) =>
81-
formal match
82-
case AppliedType(_, funArgs @ fun :: tupled :: Nil) =>
83-
def functionTypeEqual(baseFun: Type, actualArgs: List[Type],
84-
actualRet: Type, expected: Type) =
85-
expected =:= defn.FunctionOf(actualArgs, actualRet,
86-
defn.isContextFunctionType(baseFun), defn.isErasedFunctionType(baseFun))
87-
val arity: Int =
88-
if defn.isErasedFunctionType(fun) || defn.isErasedFunctionType(fun) then -1 // TODO support?
89-
else if defn.isFunctionType(fun) then
90-
// TupledFunction[(...) => R, ?]
91-
fun.dropDependentRefinement.dealias.argInfos match
92-
case funArgs :+ funRet
93-
if functionTypeEqual(fun, defn.tupleType(funArgs) :: Nil, funRet, tupled) =>
94-
// TupledFunction[(...funArgs...) => funRet, ?]
95-
funArgs.size
96-
case _ => -1
97-
else if defn.isFunctionType(tupled) then
98-
// TupledFunction[?, (...) => R]
99-
tupled.dropDependentRefinement.dealias.argInfos match
100-
case tupledArgs :: funRet :: Nil =>
101-
defn.tupleTypes(tupledArgs.dealias) match
102-
case Some(funArgs) if functionTypeEqual(tupled, funArgs, funRet, fun) =>
103-
// TupledFunction[?, ((...funArgs...)) => funRet]
104-
funArgs.size
105-
case _ => -1
106-
case _ => -1
107-
else
108-
// TupledFunction[?, ?]
109-
-1
110-
if arity == -1 then
111-
EmptyTree
112-
else if arity <= Definitions.MaxImplementedFunctionArity then
113-
ref(defn.RuntimeTupleFunctionsModule)
114-
.select(s"tupledFunction$arity".toTermName)
115-
.appliedToTypes(funArgs)
116-
else
117-
ref(defn.RuntimeTupleFunctionsModule)
118-
.select("tupledFunctionXXL".toTermName)
119-
.appliedToTypes(funArgs)
120-
case _ =>
121-
EmptyTree
122-
end synthesizedTupleFunction
123-
12480
/** If `formal` is of the form Eql[T, U], try to synthesize an
12581
* `Eql.eqlAny[T, U]` as solution.
12682
*/
@@ -408,7 +364,6 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
408364
defn.ClassTagClass -> synthesizedClassTag,
409365
defn.TypeTestClass -> synthesizedTypeTest,
410366
defn.EqlClass -> synthesizedEql,
411-
defn.TupledFunctionClass -> synthesizedTupleFunction,
412367
defn.ValueOfClass -> synthesizedValueOf,
413368
defn.Mirror_ProductClass -> synthesizedProductMirror,
414369
defn.Mirror_SumClass -> synthesizedSumMirror,

docs/docs/reference/other-new-features/tupled-function.md

Lines changed: 0 additions & 82 deletions
This file was deleted.

docs/sidebar.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ sidebar:
101101
url: docs/reference/other-new-features/parameter-untupling.html
102102
- title: Kind Polymorphism
103103
url: docs/reference/other-new-features/kind-polymorphism.html
104-
- title: Tupled Function
105-
url: docs/reference/other-new-features/tupled-function.html
106104
- title: threadUnsafe Annotation
107105
url: docs/reference/other-new-features/threadUnsafe-annotation.html
108106
- title: targetName Annotation

library/src-bootstrapped/scala/runtime/TupledFunctions.scala

Lines changed: 0 additions & 163 deletions
This file was deleted.

library/src/scala/util/TupledFunction.scala

Lines changed: 0 additions & 19 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)