Skip to content

Commit

Permalink
Revert "Add reflect defn.FunctionClass overloads" (#18473)
Browse files Browse the repository at this point in the history
Reverts #16849 on the LTS line.

Introducing new experimental overload with fewer arguments is breaking
source compatibility.

Fixes #18414
  • Loading branch information
Kordyjan authored Aug 29, 2023
2 parents 9659eb9 + fb65458 commit eaa7e18
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 52 deletions.
4 changes: 0 additions & 4 deletions compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2811,10 +2811,6 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
if isErased then
throw new Exception("Erased function classes are not supported. Use a refined `scala.runtime.ErasedFunction`")
else dotc.core.Symbols.defn.FunctionSymbol(arity, isImplicit)
def FunctionClass(arity: Int): Symbol =
FunctionClass(arity, false, false)
def FunctionClass(arity: Int, isContextual: Boolean): Symbol =
FunctionClass(arity, isContextual, false)
def ErasedFunctionClass = dotc.core.Symbols.defn.ErasedFunctionClass
def TupleClass(arity: Int): Symbol =
dotc.core.Symbols.defn.TupleType(arity).nn.classSymbol.asClass
Expand Down
19 changes: 0 additions & 19 deletions library/src/scala/quoted/Quotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4295,27 +4295,8 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
* - ...
* - Nth element is `FunctionN`
*/
// TODO: deprecate in 3.4 and stabilize FunctionClass(Int)/FunctionClass(Int,Boolean)
// @deprecated("Use overload of `FunctionClass` with 1 or 2 arguments","3.4")
def FunctionClass(arity: Int, isImplicit: Boolean = false, isErased: Boolean = false): Symbol

/** Class symbol of a function class `scala.FunctionN`.
*
* @param arity the arity of the function where `0 <= arity`
* @return class symbol of `scala.FunctionN` where `N == arity`
*/
@experimental
def FunctionClass(arity: Int): Symbol

/** Class symbol of a context function class `scala.FunctionN` or `scala.ContextFunctionN`.
*
* @param arity the arity of the function where `0 <= arity`
* @param isContextual if it is a `scala.ContextFunctionN`
* @return class symbol of `scala.FunctionN` or `scala.ContextFunctionN` where `N == arity`
*/
@experimental
def FunctionClass(arity: Int, isContextual: Boolean): Symbol

/** The `scala.runtime.ErasedFunction` built-in trait. */
@experimental
def ErasedFunctionClass: Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ val experimentalDefinitionInLibrary = Set(
"scala.annotation.MacroAnnotation",

//// New APIs: Quotes
// Should be stabilized in 3.4.0
"scala.quoted.Quotes.reflectModule.defnModule.FunctionClass",
"scala.quoted.Quotes.reflectModule.FlagsModule.AbsOverride",
// Can be stabilized in 3.4.0 (unsure) or later
"scala.quoted.Quotes.reflectModule.CompilationInfoModule.XmacroSettings",
Expand Down
26 changes: 0 additions & 26 deletions tests/run-macros/tasty-definitions-1.check
Original file line number Diff line number Diff line change
Expand Up @@ -57,57 +57,31 @@ Function23
Function24
Function25
ContextFunction0
ContextFunction0
ContextFunction1
ContextFunction1
ContextFunction2
ContextFunction2
ContextFunction3
ContextFunction3
ContextFunction4
ContextFunction4
ContextFunction5
ContextFunction5
ContextFunction6
ContextFunction6
ContextFunction7
ContextFunction7
ContextFunction8
ContextFunction8
ContextFunction9
ContextFunction9
ContextFunction10
ContextFunction10
ContextFunction11
ContextFunction11
ContextFunction12
ContextFunction12
ContextFunction13
ContextFunction13
ContextFunction14
ContextFunction14
ContextFunction15
ContextFunction15
ContextFunction16
ContextFunction16
ContextFunction17
ContextFunction17
ContextFunction18
ContextFunction18
ContextFunction19
ContextFunction19
ContextFunction20
ContextFunction20
ContextFunction21
ContextFunction21
ContextFunction22
ContextFunction22
ContextFunction23
ContextFunction23
ContextFunction24
ContextFunction24
ContextFunction25
ContextFunction25
class java.lang.Exception: Erased function classes are not supported. Use a refined `scala.runtime.ErasedFunction`
ErasedFunction
Tuple2
Expand Down
1 change: 0 additions & 1 deletion tests/run-macros/tasty-definitions-1/quoted_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ object Macros {
printout(defn.FunctionClass(i).name)

for (i <- 0 to 25)
printout(defn.FunctionClass(i, isContextual = true).name)
printout(defn.FunctionClass(i, isImplicit = true).name)

// should fail
Expand Down

0 comments on commit eaa7e18

Please sign in to comment.