Skip to content

Commit 7d8c284

Browse files
committed
Revert "Add reflect defn.FunctionClass overloads"
This reverts commit 9571b42.
1 parent 5f8485e commit 7d8c284

File tree

5 files changed

+1
-61
lines changed

5 files changed

+1
-61
lines changed

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,15 +2807,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
28072807
def SomeModule: Symbol = dotc.core.Symbols.defn.SomeClass.companionModule
28082808
def ProductClass: Symbol = dotc.core.Symbols.defn.ProductClass
28092809
def FunctionClass(arity: Int, isImplicit: Boolean = false, isErased: Boolean = false): Symbol =
2810-
if arity < 0 then throw IllegalArgumentException(s"arity: $arity")
2811-
if isErased then
2812-
throw new Exception("Erased function classes are not supported. Use a refined `scala.runtime.ErasedFunction`")
2813-
else dotc.core.Symbols.defn.FunctionSymbol(arity, isImplicit)
2814-
def FunctionClass(arity: Int): Symbol =
2815-
FunctionClass(arity, false, false)
2816-
def FunctionClass(arity: Int, isContextual: Boolean): Symbol =
2817-
FunctionClass(arity, isContextual, false)
2818-
def ErasedFunctionClass = dotc.core.Symbols.defn.ErasedFunctionClass
2810+
dotc.core.Symbols.defn.FunctionSymbol(arity, isImplicit, isErased)
28192811
def TupleClass(arity: Int): Symbol =
28202812
dotc.core.Symbols.defn.TupleType(arity).nn.classSymbol.asClass
28212813
def isTupleClass(sym: Symbol): Boolean =

library/src/scala/quoted/Quotes.scala

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4295,31 +4295,8 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
42954295
* - ...
42964296
* - Nth element is `FunctionN`
42974297
*/
4298-
// TODO: deprecate in 3.4 and stabilize FunctionClass(Int)/FunctionClass(Int,Boolean)
4299-
// @deprecated("Use overload of `FunctionClass` with 1 or 2 arguments","3.4")
43004298
def FunctionClass(arity: Int, isImplicit: Boolean = false, isErased: Boolean = false): Symbol
43014299

4302-
/** Class symbol of a function class `scala.FunctionN`.
4303-
*
4304-
* @param arity the arity of the function where `0 <= arity`
4305-
* @return class symbol of `scala.FunctionN` where `N == arity`
4306-
*/
4307-
@experimental
4308-
def FunctionClass(arity: Int): Symbol
4309-
4310-
/** Class symbol of a context function class `scala.FunctionN` or `scala.ContextFunctionN`.
4311-
*
4312-
* @param arity the arity of the function where `0 <= arity`
4313-
* @param isContextual if it is a `scala.ContextFunctionN`
4314-
* @return class symbol of `scala.FunctionN` or `scala.ContextFunctionN` where `N == arity`
4315-
*/
4316-
@experimental
4317-
def FunctionClass(arity: Int, isContextual: Boolean): Symbol
4318-
4319-
/** The `scala.runtime.ErasedFunction` built-in trait. */
4320-
@experimental
4321-
def ErasedFunctionClass: Symbol
4322-
43234300
/** Function-like object that maps arity to symbols for classes `scala.TupleX`.
43244301
* - 0th element is `NoSymbol`
43254302
* - 1st element is `NoSymbol`

tests/run-custom-args/tasty-inspector/stdlibExperimentalDefinitions.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ val experimentalDefinitionInLibrary = Set(
6363
"scala.annotation.MacroAnnotation",
6464

6565
//// New APIs: Quotes
66-
// Should be stabilized in 3.4.0
67-
"scala.quoted.Quotes.reflectModule.defnModule.FunctionClass",
6866
"scala.quoted.Quotes.reflectModule.FlagsModule.AbsOverride",
6967
// Can be stabilized in 3.4.0 (unsure) or later
7068
"scala.quoted.Quotes.reflectModule.CompilationInfoModule.XmacroSettings",

tests/run-macros/tasty-definitions-1.check

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -57,57 +57,31 @@ Function23
5757
Function24
5858
Function25
5959
ContextFunction0
60-
ContextFunction0
61-
ContextFunction1
6260
ContextFunction1
6361
ContextFunction2
64-
ContextFunction2
65-
ContextFunction3
6662
ContextFunction3
6763
ContextFunction4
68-
ContextFunction4
69-
ContextFunction5
7064
ContextFunction5
7165
ContextFunction6
72-
ContextFunction6
7366
ContextFunction7
74-
ContextFunction7
75-
ContextFunction8
7667
ContextFunction8
7768
ContextFunction9
78-
ContextFunction9
7969
ContextFunction10
80-
ContextFunction10
81-
ContextFunction11
8270
ContextFunction11
8371
ContextFunction12
84-
ContextFunction12
8572
ContextFunction13
86-
ContextFunction13
87-
ContextFunction14
8873
ContextFunction14
8974
ContextFunction15
90-
ContextFunction15
91-
ContextFunction16
9275
ContextFunction16
9376
ContextFunction17
94-
ContextFunction17
95-
ContextFunction18
9677
ContextFunction18
9778
ContextFunction19
98-
ContextFunction19
9979
ContextFunction20
100-
ContextFunction20
101-
ContextFunction21
10280
ContextFunction21
10381
ContextFunction22
104-
ContextFunction22
10582
ContextFunction23
106-
ContextFunction23
107-
ContextFunction24
10883
ContextFunction24
10984
ContextFunction25
110-
ContextFunction25
11185
class java.lang.Exception: Erased function classes are not supported. Use a refined `scala.runtime.ErasedFunction`
11286
ErasedFunction
11387
Tuple2

tests/run-macros/tasty-definitions-1/quoted_1.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ object Macros {
6060
printout(defn.FunctionClass(i).name)
6161

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

6665
// should fail

0 commit comments

Comments
 (0)