Skip to content

Commit 250c98c

Browse files
committed
using (using Context) throughout
1 parent 997d2b3 commit 250c98c

13 files changed

+457
-454
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
927927
throw new RuntimeException(msg)
928928
}
929929

930-
private def compilingArray(using ctx: Context) =
930+
private def compilingArray(using Context) =
931931
ctx.compilationUnit.source.file.name == "Array.scala"
932932
}
933933

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ object DottyBackendInterface {
193193
* True if the current compilation unit is of a primitive class (scala.Boolean et al).
194194
* Used only in assertions.
195195
*/
196-
def isCompilingPrimitive(using ctx: Context) = {
196+
def isCompilingPrimitive(using Context) = {
197197
primitiveCompilationUnits(ctx.compilationUnit.source.file.name)
198198
}
199199

compiler/src/dotty/tools/backend/jvm/GenBCode.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ object GenBCode {
7575
val name: String = "genBCode"
7676
}
7777

78-
class GenBCodePipeline(val int: DottyBackendInterface)(using ctx: Context) extends BCodeSyncAndTry {
78+
class GenBCodePipeline(val int: DottyBackendInterface)(using Context) extends BCodeSyncAndTry {
7979
import DottyBackendInterface.symExtensions
8080

8181
private var tree: Tree = _

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import java.nio.file.InvalidPathException
4040

4141
object Contexts {
4242

43+
type CState = Period
44+
4345
private val (compilerCallbackLoc, store1) = Store.empty.newLocation[CompilerCallback]()
4446
private val (sbtCallbackLoc, store2) = store1.newLocation[AnalysisCallback]()
4547
private val (printerFnLoc, store3) = store2.newLocation[Context => Printer](new RefinedPrinter(_))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ final class ProperGadtConstraint private(
217217

218218
// ---- Protected/internal -----------------------------------------------
219219

220-
override def comparerCtx(using ctx: Context): Context = ctx
220+
override def comparerCtx(using Context): Context = ctx
221221

222222
override protected def constraint = myConstraint
223223
override protected def constraint_=(c: Constraint) = myConstraint = c

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ object SymDenotations {
300300
* Makes use of `rawParamss` when present, or constructs fresh parameter symbols otherwise.
301301
* This method can be allocation-heavy.
302302
*/
303-
final def paramSymss(using ctx: Context): List[List[Symbol]] =
303+
final def paramSymss(using Context): List[List[Symbol]] =
304304

305305
def recurWithParamss(info: Type, paramss: List[List[Symbol]]): List[List[Symbol]] =
306306
info match
@@ -1447,7 +1447,7 @@ object SymDenotations {
14471447
privateWithin: Symbol = null,
14481448
annotations: List[Annotation] = null,
14491449
rawParamss: List[List[Symbol]] = null)(
1450-
using ctx: Context): SymDenotation = {
1450+
using Context): SymDenotation = {
14511451
// simulate default parameters, while also passing implicit context ctx to the default values
14521452
val initFlags1 = (if (initFlags != UndefinedFlags) initFlags else this.flags)
14531453
val info1 = if (info != null) info else this.info

compiler/src/dotty/tools/dotc/reporting/messages.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,7 +2090,7 @@ import ast.tpd
20902090
|This mechanism is used for instance in pattern ${hl("case List(x1, ..., xn)")}""".stripMargin
20912091
}
20922092

2093-
class MemberWithSameNameAsStatic()(using ctx: Context)
2093+
class MemberWithSameNameAsStatic()(using Context)
20942094
extends SyntaxMsg(MemberWithSameNameAsStaticID) {
20952095
def msg = em"Companion classes cannot define members with same name as a ${hl("@static")} member"
20962096
def explain = ""
@@ -2105,40 +2105,40 @@ import ast.tpd
21052105
|It can be removed without changing the semantics of the program. This may indicate an error.""".stripMargin
21062106
}
21072107

2108-
class TraitCompanionWithMutableStatic()(using ctx: Context)
2108+
class TraitCompanionWithMutableStatic()(using Context)
21092109
extends SyntaxMsg(TraitCompanionWithMutableStaticID) {
21102110
def msg = em"Companion of traits cannot define mutable @static fields"
21112111
def explain = ""
21122112
}
21132113

2114-
class LazyStaticField()(using ctx: Context)
2114+
class LazyStaticField()(using Context)
21152115
extends SyntaxMsg(LazyStaticFieldID) {
21162116
def msg = em"Lazy @static fields are not supported"
21172117
def explain = ""
21182118
}
21192119

2120-
class StaticOverridingNonStaticMembers()(using ctx: Context)
2120+
class StaticOverridingNonStaticMembers()(using Context)
21212121
extends SyntaxMsg(StaticOverridingNonStaticMembersID) {
21222122
def msg = em"${hl("@static")} members cannot override or implement non-static ones"
21232123
def explain = ""
21242124
}
21252125

2126-
class OverloadInRefinement(rsym: Symbol)(using ctx: Context)
2126+
class OverloadInRefinement(rsym: Symbol)(using Context)
21272127
extends DeclarationMsg(OverloadInRefinementID) {
21282128
def msg = "Refinements cannot introduce overloaded definitions"
21292129
def explain =
21302130
em"""The refinement `$rsym` introduces an overloaded definition.
21312131
|Refinements cannot contain overloaded definitions.""".stripMargin
21322132
}
21332133

2134-
class NoMatchingOverload(val alternatives: List[SingleDenotation], pt: Type)(using ctx: Context)
2134+
class NoMatchingOverload(val alternatives: List[SingleDenotation], pt: Type)(using Context)
21352135
extends TypeMismatchMsg(NoMatchingOverloadID) {
21362136
def msg =
21372137
em"""None of the ${err.overloadedAltsStr(alternatives)}
21382138
|match ${err.expectedTypeStr(pt)}"""
21392139
def explain = ""
21402140
}
2141-
class StableIdentPattern(tree: untpd.Tree, pt: Type)(using ctx: Context)
2141+
class StableIdentPattern(tree: untpd.Tree, pt: Type)(using Context)
21422142
extends TypeMsg(StableIdentPatternID) {
21432143
def msg =
21442144
em"""Stable identifier required, but $tree found"""
@@ -2147,7 +2147,7 @@ import ast.tpd
21472147

21482148
class IllegalSuperAccessor(base: Symbol, memberName: Name,
21492149
acc: Symbol, accTp: Type,
2150-
other: Symbol, otherTp: Type)(using ctx: Context) extends DeclarationMsg(IllegalSuperAccessorID) {
2150+
other: Symbol, otherTp: Type)(using Context) extends DeclarationMsg(IllegalSuperAccessorID) {
21512151
def msg = {
21522152
// The mixin containing a super-call that requires a super-accessor
21532153
val accMixin = acc.owner
@@ -2200,7 +2200,7 @@ import ast.tpd
22002200
def explain = ""
22012201
}
22022202

2203-
class TraitParameterUsedAsParentPrefix(cls: Symbol)(using ctx: Context)
2203+
class TraitParameterUsedAsParentPrefix(cls: Symbol)(using Context)
22042204
extends DeclarationMsg(TraitParameterUsedAsParentPrefixID) {
22052205
def msg =
22062206
s"${cls.show} cannot extend from a parent that is derived via its own parameters"
@@ -2215,7 +2215,7 @@ import ast.tpd
22152215
|""".stripMargin
22162216
}
22172217

2218-
class UnknownNamedEnclosingClassOrObject(name: TypeName)(using ctx: Context)
2218+
class UnknownNamedEnclosingClassOrObject(name: TypeName)(using Context)
22192219
extends ReferenceMsg(UnknownNamedEnclosingClassOrObjectID) {
22202220
def msg =
22212221
em"""no enclosing class or object is named '${hl(name.show)}'"""
@@ -2228,7 +2228,7 @@ import ast.tpd
22282228
""".stripMargin
22292229
}
22302230

2231-
class IllegalCyclicTypeReference(sym: Symbol, where: String, lastChecked: Type)(using ctx: Context)
2231+
class IllegalCyclicTypeReference(sym: Symbol, where: String, lastChecked: Type)(using Context)
22322232
extends CyclicMsg(IllegalCyclicTypeReferenceID) {
22332233
def msg =
22342234
val lastCheckedStr =
@@ -2238,7 +2238,7 @@ import ast.tpd
22382238
def explain = ""
22392239
}
22402240

2241-
class ErasedTypesCanOnlyBeFunctionTypes()(using ctx: Context)
2241+
class ErasedTypesCanOnlyBeFunctionTypes()(using Context)
22422242
extends SyntaxMsg(ErasedTypesCanOnlyBeFunctionTypesID) {
22432243
def msg = "Types with erased keyword can only be function types `(erased ...) => ...`"
22442244
def explain = ""

0 commit comments

Comments
 (0)