@@ -422,7 +422,7 @@ class Definitions {
422
422
def getWrapVarargsArrayModule : Symbol = ScalaRuntimeModule
423
423
424
424
// The set of all wrap{X, Ref}Array methods, where X is a value type
425
- val WrapArrayMethods : PerRun [collection.Set [Symbol ]] = new PerRun ({ implicit ctx =>
425
+ val WrapArrayMethods : PerRun [collection.Set [Symbol ]] = new PerRun ({
426
426
val methodNames = ScalaValueTypes .map(ast.tpd.wrapArrayMethodName) `union` Set (nme.wrapRefArray)
427
427
methodNames.map(getWrapVarargsArrayModule.requiredMethod(_))
428
428
})
@@ -983,12 +983,12 @@ class Definitions {
983
983
// ----- Symbol sets ---------------------------------------------------
984
984
985
985
@ tu lazy val AbstractFunctionType : Array [TypeRef ] = mkArityArray(" scala.runtime.AbstractFunction" , MaxImplementedFunctionArity , 0 )
986
- val AbstractFunctionClassPerRun : PerRun [Array [Symbol ]] = new PerRun (implicit ctx => AbstractFunctionType .map(_.symbol.asClass))
986
+ val AbstractFunctionClassPerRun : PerRun [Array [Symbol ]] = new PerRun (AbstractFunctionType .map(_.symbol.asClass))
987
987
def AbstractFunctionClass (n : Int )(using Context ): Symbol = AbstractFunctionClassPerRun ()(using ctx)(n)
988
988
@ tu private lazy val ImplementedFunctionType = mkArityArray(" scala.Function" , MaxImplementedFunctionArity , 0 )
989
- def FunctionClassPerRun : PerRun [Array [Symbol ]] = new PerRun (implicit ctx => ImplementedFunctionType .map(_.symbol.asClass))
989
+ def FunctionClassPerRun : PerRun [Array [Symbol ]] = new PerRun (ImplementedFunctionType .map(_.symbol.asClass))
990
990
991
- val LazyHolder : PerRun [Map [Symbol , Symbol ]] = new PerRun ({ implicit ctx =>
991
+ val LazyHolder : PerRun [Map [Symbol , Symbol ]] = new PerRun ({
992
992
def holderImpl (holderType : String ) = requiredClass(" scala.runtime." + holderType)
993
993
Map [Symbol , Symbol ](
994
994
IntClass -> holderImpl(" LazyInt" ),
@@ -1233,15 +1233,15 @@ class Definitions {
1233
1233
Function1SpecializedReturnTypes
1234
1234
1235
1235
@ tu lazy val Function1SpecializedParamClasses : PerRun [collection.Set [Symbol ]] =
1236
- new PerRun (implicit ctx => Function1SpecializedParamTypes .map(_.symbol))
1236
+ new PerRun (Function1SpecializedParamTypes .map(_.symbol))
1237
1237
@ tu lazy val Function2SpecializedParamClasses : PerRun [collection.Set [Symbol ]] =
1238
- new PerRun (implicit ctx => Function2SpecializedParamTypes .map(_.symbol))
1238
+ new PerRun (Function2SpecializedParamTypes .map(_.symbol))
1239
1239
@ tu lazy val Function0SpecializedReturnClasses : PerRun [collection.Set [Symbol ]] =
1240
- new PerRun (implicit ctx => Function0SpecializedReturnTypes .map(_.symbol))
1240
+ new PerRun (Function0SpecializedReturnTypes .map(_.symbol))
1241
1241
@ tu lazy val Function1SpecializedReturnClasses : PerRun [collection.Set [Symbol ]] =
1242
- new PerRun (implicit ctx => Function1SpecializedReturnTypes .map(_.symbol))
1242
+ new PerRun (Function1SpecializedReturnTypes .map(_.symbol))
1243
1243
@ tu lazy val Function2SpecializedReturnClasses : PerRun [collection.Set [Symbol ]] =
1244
- new PerRun (implicit ctx => Function2SpecializedReturnTypes .map(_.symbol))
1244
+ new PerRun (Function2SpecializedReturnTypes .map(_.symbol))
1245
1245
1246
1246
def isSpecializableFunction (cls : ClassSymbol , paramTypes : List [Type ], retType : Type )(using Context ): Boolean =
1247
1247
paramTypes.length <= 2 && cls.derivesFrom(FunctionClass (paramTypes.length)) && (paramTypes match {
@@ -1352,13 +1352,12 @@ class Definitions {
1352
1352
1353
1353
// ----- primitive value class machinery ------------------------------------------
1354
1354
1355
- /** This class would also be obviated by the implicit function type design */
1356
- class PerRun [T ](generate : Context => T ) {
1355
+ class PerRun [T ](generate : Context ?=> T ) {
1357
1356
private var current : RunId = NoRunId
1358
1357
private var cached : T = _
1359
1358
def apply ()(using Context ): T = {
1360
1359
if (current != currentRunId) {
1361
- cached = generate(ctx)
1360
+ cached = generate
1362
1361
current = currentRunId
1363
1362
}
1364
1363
cached
@@ -1371,10 +1370,10 @@ class Definitions {
1371
1370
@ tu private lazy val ScalaNumericValueTypes : collection.Set [TypeRef ] = ScalaNumericValueTypeList .toSet
1372
1371
@ tu private lazy val ScalaValueTypes : collection.Set [TypeRef ] = ScalaNumericValueTypes `union` Set (UnitType , BooleanType )
1373
1372
1374
- val ScalaNumericValueClasses : PerRun [collection.Set [Symbol ]] = new PerRun (implicit ctx => ScalaNumericValueTypes .map(_.symbol))
1375
- val ScalaValueClasses : PerRun [collection.Set [Symbol ]] = new PerRun (implicit ctx => ScalaValueTypes .map(_.symbol))
1373
+ val ScalaNumericValueClasses : PerRun [collection.Set [Symbol ]] = new PerRun (ScalaNumericValueTypes .map(_.symbol))
1374
+ val ScalaValueClasses : PerRun [collection.Set [Symbol ]] = new PerRun (ScalaValueTypes .map(_.symbol))
1376
1375
1377
- val ScalaBoxedClasses : PerRun [collection.Set [Symbol ]] = new PerRun (implicit ctx =>
1376
+ val ScalaBoxedClasses : PerRun [collection.Set [Symbol ]] = new PerRun (
1378
1377
Set (BoxedByteClass , BoxedShortClass , BoxedCharClass , BoxedIntClass , BoxedLongClass , BoxedFloatClass , BoxedDoubleClass , BoxedUnitClass , BoxedBooleanClass )
1379
1378
)
1380
1379
0 commit comments