summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/reflect/scala/reflect/api/StandardDefinitions.scala18
-rw-r--r--src/reflect/scala/reflect/internal/Definitions.scala2
2 files changed, 14 insertions, 6 deletions
diff --git a/src/reflect/scala/reflect/api/StandardDefinitions.scala b/src/reflect/scala/reflect/api/StandardDefinitions.scala
index e255d305f7..1a8885e6b5 100644
--- a/src/reflect/scala/reflect/api/StandardDefinitions.scala
+++ b/src/reflect/scala/reflect/api/StandardDefinitions.scala
@@ -214,6 +214,14 @@ trait StandardDefinitions {
/** The module symbol of module `scala.Some`. */
def SomeModule: ModuleSymbol
+ /** Function-like api that lets you acess symbol
+ * of the definition with given arity and also look
+ * through all known symbols via `seq`.
+ */
+ abstract class VarArityClassApi extends (Int => Symbol) {
+ def seq: Seq[ClassSymbol]
+ }
+
/** Function-like object that maps arity to symbols for classes `scala.ProductX`.
* - 0th element is `Unit`
* - 1st element is `Product1`
@@ -222,7 +230,7 @@ trait StandardDefinitions {
* - 23nd element is `NoSymbol`
* - ...
*/
- def ProductClass: Int => Symbol
+ def ProductClass: VarArityClassApi
/** Function-like object that maps arity to symbols for classes `scala.FunctionX`.
* - 0th element is `Function0`
@@ -232,17 +240,17 @@ trait StandardDefinitions {
* - 23nd element is `NoSymbol`
* - ...
*/
- def FunctionClass: Int => Symbol
+ def FunctionClass: VarArityClassApi
/** Function-like object that maps arity to symbols for classes `scala.TupleX`.
* - 0th element is `NoSymbol`
- * - 1st element is `Product1`
+ * - 1st element is `Tuple1`
* - ...
- * - 22nd element is `Product22`
+ * - 22nd element is `Tuple22`
* - 23nd element is `NoSymbol`
* - ...
*/
- def TupleClass: Int => Symbol
+ def TupleClass: VarArityClassApi
/** Contains Scala primitive value classes:
* - Byte
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala
index c2939e69b5..5b06239863 100644
--- a/src/reflect/scala/reflect/internal/Definitions.scala
+++ b/src/reflect/scala/reflect/internal/Definitions.scala
@@ -522,7 +522,7 @@ trait Definitions extends api.StandardDefinitions {
def hasJavaMainMethod(sym: Symbol): Boolean =
(sym.tpe member nme.main).alternatives exists isJavaMainMethod
- class VarArityClass(name: String, maxArity: Int, countFrom: Int = 0, init: Option[ClassSymbol] = None) extends (Int => Symbol) {
+ class VarArityClass(name: String, maxArity: Int, countFrom: Int = 0, init: Option[ClassSymbol] = None) extends VarArityClassApi {
private val offset = countFrom - init.size
private def isDefinedAt(i: Int) = i < seq.length + offset && i >= offset
val seq: IndexedSeq[ClassSymbol] = (init ++: countFrom.to(maxArity).map { i => getRequiredClass("scala." + name + i) }).toVector