Skip to content

Commit 025bb1f

Browse files
committed
Update shapeless after annotation change in previous commit
Also added `primaryConstructor` to the reflection API for convenience.
1 parent 49b1dca commit 025bb1f

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ object SymDenotations {
387387
final def setParamssFromDefs(tparams: List[TypeDef[?]], vparamss: List[List[ValDef[?]]])(using Context): Unit =
388388
setParamss(tparams.map(_.symbol), vparamss.map(_.map(_.symbol)))
389389

390-
/** A pair consistsing of type paremeter symbols and value parameter symbol lists
390+
/** A pair consisting of type parameter symbols and value parameter symbol lists
391391
* of this method definition, or (Nil, Nil) for other symbols.
392392
* Makes use of `rawParamss` when present, or constructs fresh parameter symbols otherwise.
393393
* This method can be allocation-heavy.

compiler/src/dotty/tools/dotc/tastyreflect/ReflectionCompilerInterface.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,6 +1752,9 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
17521752
def Symbol_paramSymss(self: Symbol)(using ctx: Context): (List[Symbol], List[List[Symbol]]) =
17531753
self.paramSymss
17541754

1755+
def Symbol_primaryConstructor(self: Symbol)(using Context): Symbol =
1756+
self.primaryConstructor
1757+
17551758
def Symbol_caseFields(self: Symbol)(using ctx: Context): List[Symbol] =
17561759
if (!self.isClass) Nil
17571760
else self.asClass.paramAccessors.collect {

library/src/scala/tasty/Reflection.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2223,12 +2223,16 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
22232223
def methods(using ctx: Context): List[Symbol] =
22242224
internal.Symbol_methods(sym)
22252225

2226-
/** A pair consistsing of type paremeter symbols and value parameter symbol lists
2226+
/** A pair consisting of type parameter symbols and value parameter symbol lists
22272227
* of this method definition, or (Nil, Nil) for other symbols.
22282228
*/
22292229
def paramSymss(using ctx: Context): (List[Symbol], List[List[Symbol]]) =
22302230
internal.Symbol_paramSymss(sym)
22312231

2232+
/** The primary constructor of a class or trait, `noSymbol` if not applicable. */
2233+
def primaryConstructor(using Context): Symbol =
2234+
internal.Symbol_primaryConstructor(sym)
2235+
22322236
/** Fields of a case class type -- only the ones declared in primary constructor */
22332237
def caseFields(using ctx: Context): List[Symbol] =
22342238
internal.Symbol_caseFields(sym)

library/src/scala/tasty/reflect/CompilerInterface.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,11 +1305,14 @@ trait CompilerInterface {
13051305
/** Get all non-private methods declared or inherited */
13061306
def Symbol_methods(self: Symbol)(using ctx: Context): List[Symbol]
13071307

1308-
/** A pair consistsing of type paremeter symbols and value parameter symbol lists
1308+
/** A pair consisting of type parameter symbols and value parameter symbol lists
13091309
* of this method definition, or (Nil, Nil) for other symbols.
13101310
*/
13111311
def Symbol_paramSymss(self: Symbol)(using ctx: Context): (List[Symbol], List[List[Symbol]])
13121312

1313+
/** The primary constructor of a class or trait, `noSymbol` if not applicable. */
1314+
def Symbol_primaryConstructor(self: Symbol)(using Context): Symbol
1315+
13131316
/** Fields of a case class type -- only the ones declared in primary constructor */
13141317
def Symbol_caseFields(self: Symbol)(using ctx: Context): List[Symbol]
13151318

0 commit comments

Comments
 (0)