Skip to content

Commit c78ba22

Browse files
committed
Remove Context from CompilerInterface
1 parent 97e2b66 commit c78ba22

File tree

2 files changed

+160
-160
lines changed

2 files changed

+160
-160
lines changed

compiler/src/dotty/tools/dotc/quoted/reflect/ReflectionCompilerInterface.scala

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,11 +1138,11 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
11381138
case _ => None
11391139
}
11401140

1141-
def TypeBounds_apply(low: Type, hi: Type)(using Context): TypeBounds =
1141+
def TypeBounds_apply(low: Type, hi: Type): TypeBounds =
11421142
Types.TypeBounds(low, hi)
11431143

1144-
def TypeBounds_low(self: TypeBounds)(using Context): Type = self.lo
1145-
def TypeBounds_hi(self: TypeBounds)(using Context): Type = self.hi
1144+
def TypeBounds_low(self: TypeBounds): Type = self.lo
1145+
def TypeBounds_hi(self: TypeBounds): Type = self.hi
11461146

11471147
type Type = Types.Type
11481148

@@ -1154,7 +1154,7 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
11541154
case _ => None
11551155
}
11561156

1157-
def Type_apply(clazz: Class[?])(using Context): Type =
1157+
def Type_apply(clazz: Class[?]): Type =
11581158
if (clazz.isPrimitive)
11591159
if (clazz == classOf[Boolean]) defn.BooleanType
11601160
else if (clazz == classOf[Byte]) defn.ByteType
@@ -1176,54 +1176,54 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
11761176
}
11771177
else getClassIfDefined(clazz.getCanonicalName).typeRef
11781178

1179-
def Type_isTypeEq(self: Type)(that: Type)(using Context): Boolean = self =:= that
1179+
def Type_isTypeEq(self: Type)(that: Type): Boolean = self =:= that
11801180

1181-
def Type_isSubType(self: Type)(that: Type)(using Context): Boolean = self <:< that
1181+
def Type_isSubType(self: Type)(that: Type): Boolean = self <:< that
11821182

1183-
def Type_widen(self: Type)(using Context): Type = self.widen
1183+
def Type_widen(self: Type): Type = self.widen
11841184

1185-
def Type_widenTermRefExpr(self: Type)(using Context): Type = self.widenTermRefExpr
1185+
def Type_widenTermRefExpr(self: Type): Type = self.widenTermRefExpr
11861186

1187-
def Type_dealias(self: Type)(using Context): Type = self.dealias
1187+
def Type_dealias(self: Type): Type = self.dealias
11881188

1189-
def Type_simplified(self: Type)(using Context): Type = self.simplified
1189+
def Type_simplified(self: Type): Type = self.simplified
11901190

1191-
def Type_classSymbol(self: Type)(using Context): Option[Symbol] =
1191+
def Type_classSymbol(self: Type): Option[Symbol] =
11921192
if (self.classSymbol.exists) Some(self.classSymbol.asClass) else None
11931193

1194-
def Type_typeSymbol(self: Type)(using Context): Symbol = self.typeSymbol
1194+
def Type_typeSymbol(self: Type): Symbol = self.typeSymbol
11951195

1196-
def Type_termSymbol(self: Type)(using Context): Symbol = self.termSymbol
1196+
def Type_termSymbol(self: Type): Symbol = self.termSymbol
11971197

1198-
def Type_isSingleton(self: Type)(using Context): Boolean = self.isSingleton
1198+
def Type_isSingleton(self: Type): Boolean = self.isSingleton
11991199

1200-
def Type_memberType(self: Type)(member: Symbol)(using Context): Type =
1200+
def Type_memberType(self: Type)(member: Symbol): Type =
12011201
member.info.asSeenFrom(self, member.owner)
12021202

1203-
def Type_baseClasses(self: Type)(using Context): List[Symbol] =
1203+
def Type_baseClasses(self: Type): List[Symbol] =
12041204
self.baseClasses
12051205

1206-
def Type_baseType(self: Type)(cls: Symbol)(using Context): Type =
1206+
def Type_baseType(self: Type)(cls: Symbol): Type =
12071207
self.baseType(cls)
12081208

1209-
def Type_derivesFrom(self: Type)(cls: Symbol)(using Context): Boolean =
1209+
def Type_derivesFrom(self: Type)(cls: Symbol): Boolean =
12101210
self.derivesFrom(cls)
12111211

1212-
def Type_isFunctionType(self: Type)(using Context): Boolean =
1212+
def Type_isFunctionType(self: Type): Boolean =
12131213
defn.isFunctionType(self)
12141214

1215-
def Type_isContextFunctionType(self: Type)(using Context): Boolean =
1215+
def Type_isContextFunctionType(self: Type): Boolean =
12161216
defn.isContextFunctionType(self)
12171217

1218-
def Type_isErasedFunctionType(self: Type)(using Context): Boolean =
1218+
def Type_isErasedFunctionType(self: Type): Boolean =
12191219
defn.isErasedFunctionType(self)
12201220

1221-
def Type_isDependentFunctionType(self: Type)(using Context): Boolean = {
1221+
def Type_isDependentFunctionType(self: Type): Boolean = {
12221222
val tpNoRefinement = self.dropDependentRefinement
12231223
tpNoRefinement != self && defn.isNonRefinedFunction(tpNoRefinement)
12241224
}
12251225

1226-
def Type_select(self: Type)(sym: Symbol)(using Context): Type =
1226+
def Type_select(self: Type)(sym: Symbol): Type =
12271227
self.select(sym)
12281228

12291229
type ConstantType = Types.ConstantType
@@ -1235,10 +1235,10 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
12351235
case _ => None
12361236
}
12371237

1238-
def ConstantType_apply(const: Constant)(using Context): ConstantType =
1238+
def ConstantType_apply(const: Constant): ConstantType =
12391239
Types.ConstantType(const)
12401240

1241-
def ConstantType_constant(self: ConstantType)(using Context): Constant = self.value
1241+
def ConstantType_constant(self: ConstantType): Constant = self.value
12421242

12431243
type TermRef = Types.NamedType
12441244

@@ -1249,12 +1249,12 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
12491249
case _ => None
12501250
}
12511251

1252-
def TermRef_apply(qual: TypeOrBounds, name: String)(using Context): TermRef =
1252+
def TermRef_apply(qual: TypeOrBounds, name: String): TermRef =
12531253
Types.TermRef(qual, name.toTermName)
12541254

1255-
def TermRef_qualifier(self: TermRef)(using Context): TypeOrBounds = self.prefix
1255+
def TermRef_qualifier(self: TermRef): TypeOrBounds = self.prefix
12561256

1257-
def TermRef_name(self: TermRef)(using Context): String = self.name.toString
1257+
def TermRef_name(self: TermRef): String = self.name.toString
12581258

12591259
type TypeRef = Types.NamedType
12601260

@@ -1265,13 +1265,13 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
12651265
case _ => None
12661266
}
12671267

1268-
def TypeRef_qualifier(self: TypeRef)(using Context): TypeOrBounds = self.prefix
1268+
def TypeRef_qualifier(self: TypeRef): TypeOrBounds = self.prefix
12691269

1270-
def TypeRef_name(self: TypeRef)(using Context): String = self.name.toString
1270+
def TypeRef_name(self: TypeRef): String = self.name.toString
12711271

1272-
def TypeRef_isOpaqueAlias(self: TypeRef)(using Context): Boolean = self.symbol.isOpaqueAlias
1272+
def TypeRef_isOpaqueAlias(self: TypeRef): Boolean = self.symbol.isOpaqueAlias
12731273

1274-
def TypeRef_translucentSuperType(self: TypeRef)(using Context): Type = self.translucentSuperType
1274+
def TypeRef_translucentSuperType(self: TypeRef): Type = self.translucentSuperType
12751275

12761276
type NamedTermRef = Types.NamedType
12771277

@@ -1286,8 +1286,8 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
12861286
case _ => None
12871287
}
12881288

1289-
def NamedTermRef_name(self: NamedTermRef)(using Context): String = self.name.toString
1290-
def NamedTermRef_qualifier(self: NamedTermRef)(using Context): TypeOrBounds = self.prefix
1289+
def NamedTermRef_name(self: NamedTermRef): String = self.name.toString
1290+
def NamedTermRef_qualifier(self: NamedTermRef): TypeOrBounds = self.prefix
12911291

12921292
type SuperType = Types.SuperType
12931293

@@ -1298,11 +1298,11 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
12981298
case _ => None
12991299
}
13001300

1301-
def SuperType_apply(thistpe: Type, supertpe: Type)(using Context): SuperType =
1301+
def SuperType_apply(thistpe: Type, supertpe: Type): SuperType =
13021302
Types.SuperType(thistpe, supertpe)
13031303

1304-
def SuperType_thistpe(self: SuperType)(using Context): Type = self.thistpe
1305-
def SuperType_supertpe(self: SuperType)(using Context): Type = self.supertpe
1304+
def SuperType_thistpe(self: SuperType): Type = self.thistpe
1305+
def SuperType_supertpe(self: SuperType): Type = self.supertpe
13061306

13071307
type Refinement = Types.RefinedType
13081308

@@ -1313,17 +1313,17 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
13131313
case _ => None
13141314
}
13151315

1316-
def Refinement_apply(parent: Type, name: String, info: TypeOrBounds /* Type | TypeBounds */)(using Context): Refinement = {
1316+
def Refinement_apply(parent: Type, name: String, info: TypeOrBounds /* Type | TypeBounds */): Refinement = {
13171317
val name1 =
13181318
info match
13191319
case _: TypeBounds => name.toTypeName
13201320
case _ => name.toTermName
13211321
Types.RefinedType(parent, name1, info)
13221322
}
13231323

1324-
def Refinement_parent(self: Refinement)(using Context): Type = self.parent
1325-
def Refinement_name(self: Refinement)(using Context): String = self.refinedName.toString
1326-
def Refinement_info(self: Refinement)(using Context): TypeOrBounds = self.refinedInfo
1324+
def Refinement_parent(self: Refinement): Type = self.parent
1325+
def Refinement_name(self: Refinement): String = self.refinedName.toString
1326+
def Refinement_info(self: Refinement): TypeOrBounds = self.refinedInfo
13271327

13281328
type AppliedType = Types.AppliedType
13291329

@@ -1334,10 +1334,10 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
13341334
case _ => None
13351335
}
13361336

1337-
def AppliedType_tycon(self: AppliedType)(using Context): Type = self.tycon
1338-
def AppliedType_args(self: AppliedType)(using Context): List[TypeOrBounds] = self.args
1337+
def AppliedType_tycon(self: AppliedType): Type = self.tycon
1338+
def AppliedType_args(self: AppliedType): List[TypeOrBounds] = self.args
13391339

1340-
def AppliedType_apply(tycon: Type, args: List[TypeOrBounds])(using Context): AppliedType = Types.AppliedType(tycon, args)
1340+
def AppliedType_apply(tycon: Type, args: List[TypeOrBounds]): AppliedType = Types.AppliedType(tycon, args)
13411341

13421342
type AnnotatedType = Types.AnnotatedType
13431343

@@ -1348,11 +1348,11 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
13481348
case _ => None
13491349
}
13501350

1351-
def AnnotatedType_apply(underlying: Type, annot: Term)(using Context): AnnotatedType =
1351+
def AnnotatedType_apply(underlying: Type, annot: Term): AnnotatedType =
13521352
Types.AnnotatedType(underlying, Annotations.Annotation(annot))
13531353

1354-
def AnnotatedType_underlying(self: AnnotatedType)(using Context): Type = self.underlying.stripTypeVar
1355-
def AnnotatedType_annot(self: AnnotatedType)(using Context): Term = self.annot.tree
1354+
def AnnotatedType_underlying(self: AnnotatedType): Type = self.underlying.stripTypeVar
1355+
def AnnotatedType_annot(self: AnnotatedType): Term = self.annot.tree
13561356

13571357
type AndType = Types.AndType
13581358

@@ -1363,11 +1363,11 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
13631363
case _ => None
13641364
}
13651365

1366-
def AndType_apply(lhs: Type, rhs: Type)(using Context): AndType =
1366+
def AndType_apply(lhs: Type, rhs: Type): AndType =
13671367
Types.AndType(lhs, rhs)
13681368

1369-
def AndType_left(self: AndType)(using Context): Type = self.tp1.stripTypeVar
1370-
def AndType_right(self: AndType)(using Context): Type = self.tp2.stripTypeVar
1369+
def AndType_left(self: AndType): Type = self.tp1.stripTypeVar
1370+
def AndType_right(self: AndType): Type = self.tp2.stripTypeVar
13711371

13721372
type OrType = Types.OrType
13731373

@@ -1378,11 +1378,11 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
13781378
case _ => None
13791379
}
13801380

1381-
def OrType_apply(lhs: Type, rhs: Type)(using Context): OrType =
1381+
def OrType_apply(lhs: Type, rhs: Type): OrType =
13821382
Types.OrType(lhs, rhs)
13831383

1384-
def OrType_left(self: OrType)(using Context): Type = self.tp1.stripTypeVar
1385-
def OrType_right(self: OrType)(using Context): Type = self.tp2.stripTypeVar
1384+
def OrType_left(self: OrType): Type = self.tp1.stripTypeVar
1385+
def OrType_right(self: OrType): Type = self.tp2.stripTypeVar
13861386

13871387
type MatchType = Types.MatchType
13881388

@@ -1393,12 +1393,12 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
13931393
case _ => None
13941394
}
13951395

1396-
def MatchType_apply(bound: Type, scrutinee: Type, cases: List[Type])(using Context): MatchType =
1396+
def MatchType_apply(bound: Type, scrutinee: Type, cases: List[Type]): MatchType =
13971397
Types.MatchType(bound, scrutinee, cases)
13981398

1399-
def MatchType_bound(self: MatchType)(using Context): Type = self.bound
1400-
def MatchType_scrutinee(self: MatchType)(using Context): Type = self.scrutinee
1401-
def MatchType_cases(self: MatchType)(using Context): List[Type] = self.cases
1399+
def MatchType_bound(self: MatchType): Type = self.bound
1400+
def MatchType_scrutinee(self: MatchType): Type = self.scrutinee
1401+
def MatchType_cases(self: MatchType): List[Type] = self.cases
14021402

14031403
type ByNameType = Types.ExprType
14041404

@@ -1409,9 +1409,9 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
14091409
case _ => None
14101410
}
14111411

1412-
def ByNameType_apply(underlying: Type)(using Context): Type = Types.ExprType(underlying)
1412+
def ByNameType_apply(underlying: Type): Type = Types.ExprType(underlying)
14131413

1414-
def ByNameType_underlying(self: ByNameType)(using Context): Type = self.resType.stripTypeVar
1414+
def ByNameType_underlying(self: ByNameType): Type = self.resType.stripTypeVar
14151415

14161416
type ParamRef = Types.ParamRef
14171417

@@ -1423,9 +1423,9 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
14231423
case _ => None
14241424
}
14251425

1426-
def ParamRef_binder(self: ParamRef)(using Context): LambdaType[TypeOrBounds] =
1426+
def ParamRef_binder(self: ParamRef): LambdaType[TypeOrBounds] =
14271427
self.binder.asInstanceOf[LambdaType[TypeOrBounds]] // Cast to tpd
1428-
def ParamRef_paramNum(self: ParamRef)(using Context): Int = self.paramNum
1428+
def ParamRef_paramNum(self: ParamRef): Int = self.paramNum
14291429

14301430
type ThisType = Types.ThisType
14311431

@@ -1436,7 +1436,7 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
14361436
case _ => None
14371437
}
14381438

1439-
def ThisType_tref(self: ThisType)(using Context): Type = self.tref
1439+
def ThisType_tref(self: ThisType): Type = self.tref
14401440

14411441
type RecursiveThis = Types.RecThis
14421442

@@ -1447,7 +1447,7 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
14471447
case _ => None
14481448
}
14491449

1450-
def RecursiveThis_binder(self: RecursiveThis)(using Context): RecursiveType = self.binder
1450+
def RecursiveThis_binder(self: RecursiveThis): RecursiveType = self.binder
14511451

14521452
type RecursiveType = Types.RecType
14531453

@@ -1458,12 +1458,12 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
14581458
case _ => None
14591459
}
14601460

1461-
def RecursiveType_apply(parentExp: RecursiveType => Type)(using Context): RecursiveType =
1461+
def RecursiveType_apply(parentExp: RecursiveType => Type): RecursiveType =
14621462
Types.RecType(parentExp)
14631463

1464-
def RecursiveType_underlying(self: RecursiveType)(using Context): Type = self.underlying.stripTypeVar
1464+
def RecursiveType_underlying(self: RecursiveType): Type = self.underlying.stripTypeVar
14651465

1466-
def RecursiveThis_recThis(self: RecursiveType)(using Context): RecursiveThis = self.recThis
1466+
def RecursiveThis_recThis(self: RecursiveType): RecursiveThis = self.recThis
14671467

14681468
type LambdaType[ParamInfo] = Types.LambdaType { type PInfo = ParamInfo }
14691469

@@ -1481,10 +1481,10 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
14811481

14821482
def MethodType_isErased(self: MethodType): Boolean = self.isErasedMethod
14831483
def MethodType_isImplicit(self: MethodType): Boolean = self.isImplicitMethod
1484-
def MethodType_param(self: MethodType, idx: Int)(using Context): Type = self.newParamRef(idx)
1485-
def MethodType_paramNames(self: MethodType)(using Context): List[String] = self.paramNames.map(_.toString)
1486-
def MethodType_paramTypes(self: MethodType)(using Context): List[Type] = self.paramInfos
1487-
def MethodType_resType(self: MethodType)(using Context): Type = self.resType
1484+
def MethodType_param(self: MethodType, idx: Int): Type = self.newParamRef(idx)
1485+
def MethodType_paramNames(self: MethodType): List[String] = self.paramNames.map(_.toString)
1486+
def MethodType_paramTypes(self: MethodType): List[Type] = self.paramInfos
1487+
def MethodType_resType(self: MethodType): Type = self.resType
14881488

14891489
type PolyType = Types.PolyType
14901490

@@ -1495,13 +1495,13 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
14951495
case _ => None
14961496
}
14971497

1498-
def PolyType_apply(paramNames: List[String])(paramBoundsExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type)(using Context): PolyType =
1498+
def PolyType_apply(paramNames: List[String])(paramBoundsExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type): PolyType =
14991499
Types.PolyType(paramNames.map(_.toTypeName))(paramBoundsExp, resultTypeExp)
15001500

1501-
def PolyType_param(self: PolyType, idx: Int)(using Context): Type = self.newParamRef(idx)
1502-
def PolyType_paramNames(self: PolyType)(using Context): List[String] = self.paramNames.map(_.toString)
1503-
def PolyType_paramBounds(self: PolyType)(using Context): List[TypeBounds] = self.paramInfos
1504-
def PolyType_resType(self: PolyType)(using Context): Type = self.resType
1501+
def PolyType_param(self: PolyType, idx: Int): Type = self.newParamRef(idx)
1502+
def PolyType_paramNames(self: PolyType): List[String] = self.paramNames.map(_.toString)
1503+
def PolyType_paramBounds(self: PolyType): List[TypeBounds] = self.paramInfos
1504+
def PolyType_resType(self: PolyType): Type = self.resType
15051505

15061506
type TypeLambda = Types.TypeLambda
15071507

@@ -1515,11 +1515,11 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
15151515
def TypeLambda_apply(paramNames: List[String], boundsFn: TypeLambda => List[TypeBounds], bodyFn: TypeLambda => Type): TypeLambda =
15161516
Types.HKTypeLambda(paramNames.map(_.toTypeName))(boundsFn, bodyFn)
15171517

1518-
def TypeLambda_paramNames(self: TypeLambda)(using Context): List[String] = self.paramNames.map(_.toString)
1519-
def TypeLambda_paramBounds(self: TypeLambda)(using Context): List[TypeBounds] = self.paramInfos
1520-
def TypeLambda_param(self: TypeLambda, idx: Int)(using Context): Type =
1518+
def TypeLambda_paramNames(self: TypeLambda): List[String] = self.paramNames.map(_.toString)
1519+
def TypeLambda_paramBounds(self: TypeLambda): List[TypeBounds] = self.paramInfos
1520+
def TypeLambda_param(self: TypeLambda, idx: Int): Type =
15211521
self.newParamRef(idx)
1522-
def TypeLambda_resType(self: TypeLambda)(using Context): Type = self.resType
1522+
def TypeLambda_resType(self: TypeLambda): Type = self.resType
15231523

15241524

15251525
//////////////////////
@@ -1702,9 +1702,9 @@ class ReflectionCompilerInterface(val rootContext: Context) extends CompilerInte
17021702

17031703
def Symbol_pos(self: Symbol): Position = self.sourcePos
17041704

1705-
def Symbol_localContext(self: Symbol): Context =
1706-
if (self.exists) ctx.withOwner(self)
1707-
else ctx
1705+
// def Symbol_localContext(self: Symbol): Context =
1706+
// if (self.exists) ctx.withOwner(self)
1707+
// else ctx
17081708

17091709
def Symbol_comment(self: Symbol): Option[Comment] = {
17101710
import dotty.tools.dotc.core.Comments.CommentsContext

0 commit comments

Comments
 (0)