Skip to content

Commit 0d570f3

Browse files
nicolasstuckiodersky
authored andcommitted
Update given syntax in the compiler and library
1 parent 5c96a7c commit 0d570f3

File tree

30 files changed

+319
-319
lines changed

30 files changed

+319
-319
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ object DottyBackendInterface {
124124
requiredModule(className)
125125
}
126126

127-
given symExtensions as AnyRef:
127+
given symExtensions: AnyRef with
128128
extension (sym: Symbol):
129129

130130
def isInterface(using Context): Boolean = (sym.is(PureInterface)) || sym.is(Trait)

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
8585
private var myCtx = rootContext(using ictx)
8686

8787
/** The context created for this run */
88-
given runContext[Dummy_so_its_a_def] as Context = myCtx
88+
given runContext[Dummy_so_its_a_def]: Context = myCtx
8989
assert(runContext.runId <= Periods.MaxPossibleRunId)
9090

9191
private var myUnits: List[CompilationUnit] = _

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ object Trees {
15531553
def applyOverloaded(
15541554
receiver: tpd.Tree, method: TermName, args: List[Tree], targs: List[Type],
15551555
expectedType: Type)(using parentCtx: Context): tpd.Tree = {
1556-
given ctx as Context = parentCtx.retractMode(Mode.ImplicitsEnabled)
1556+
given ctx: Context = parentCtx.retractMode(Mode.ImplicitsEnabled)
15571557
import dotty.tools.dotc.ast.tpd.TreeOps
15581558

15591559
val typer = ctx.typer

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object Comments {
1515
val ContextDoc: Key[ContextDocstrings] = new Key[ContextDocstrings]
1616

1717
/** Decorator for getting docbase out of context */
18-
given CommentsContext as AnyRef:
18+
given CommentsContext: AnyRef with
1919
extension (c: Context) def docCtx: Option[ContextDocstrings] = c.property(ContextDoc)
2020

2121
/** Context for Docstrings, contains basic functionality for getting

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ object Contexts {
649649
def setDebug: this.type = setSetting(base.settings.Ydebug, true)
650650
}
651651

652-
given ops as AnyRef:
652+
given ops: AnyRef with
653653
extension (c: Context):
654654
def addNotNullInfo(info: NotNullInfo) =
655655
c.withNotNullInfos(c.notNullInfos.extendWith(info))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Definitions {
3838
import Definitions._
3939

4040
private var initCtx: Context = _
41-
private given currentContext[Dummy_so_its_a_def] as Context = initCtx
41+
private given currentContext[Dummy_so_its_a_def]: Context = initCtx
4242

4343
private def newPermanentSymbol[N <: Name](owner: Symbol, name: N, flags: FlagSet, info: Type) =
4444
newSymbol(owner, name, flags | Permanent, info)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
3434
private var myContext: Context = initctx
3535
def comparerContext: Context = myContext
3636

37-
protected given [DummySoItsADef] as Context = myContext
37+
protected given [DummySoItsADef]: Context = myContext
3838

3939
protected var state: TyperState = null
4040
def constraint: Constraint = state.constraint

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
2121
* Overridden in RefinedPrinter.
2222
*/
2323
protected def curCtx: Context = _ctx.addMode(Mode.Printing)
24-
protected given [DummyToEnforceDef] as Context = curCtx
24+
protected given [DummyToEnforceDef]: Context = curCtx
2525

2626
protected def printDebug = ctx.settings.YprintDebug.value
2727

@@ -39,7 +39,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
3939
limiter.register(str)
4040
Texts.Str(str, lineRange)
4141

42-
given stringToText as Conversion[String, Text] = Str(_)
42+
given stringToText: Conversion[String, Text] = Str(_)
4343

4444
/** If true, tweak output so it is the same before and after pickling */
4545
protected def homogenizedView: Boolean = ctx.settings.YtestPickler.value

compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ object Scala3:
6868
end Symbols
6969

7070

71-
given NameOps as AnyRef:
71+
given NameOps: AnyRef with
7272
extension (name: Name):
7373
def isWildcard = name match
7474
case nme.WILDCARD | WILDCARDTypeName => true
@@ -89,7 +89,7 @@ object Scala3:
8989
}
9090
end NameOps
9191

92-
given SymbolOps as AnyRef:
92+
given SymbolOps: AnyRef with
9393
extension (sym: Symbol):
9494

9595
def ifExists(using Context): Option[Symbol] = if sym.exists then Some(sym) else None
@@ -145,7 +145,7 @@ object Scala3:
145145
case '/' | '.' | '#' | ']' | ')' => true
146146
case _ => false
147147

148-
given StringOps as AnyRef:
148+
given StringOps: AnyRef with
149149
extension (symbol: String):
150150
def isSymbol: Boolean = !symbol.isEmpty
151151
def isRootPackage: Boolean = RootPackage == symbol
@@ -169,7 +169,7 @@ object Scala3:
169169
isJavaIdentifierStart(symbol.head) && symbol.tail.forall(isJavaIdentifierPart)
170170
end StringOps
171171

172-
given InfoOps as AnyRef:
172+
given InfoOps: AnyRef with
173173
extension (info: SymbolInformation):
174174
def isAbstract: Boolean = (info.properties & SymbolInformation.Property.ABSTRACT.value) != 0
175175
def isFinal: Boolean = (info.properties & SymbolInformation.Property.FINAL.value) != 0
@@ -204,13 +204,13 @@ object Scala3:
204204
def isInterface: Boolean = info.kind.isInterface
205205
end InfoOps
206206

207-
given RangeOps as AnyRef:
207+
given RangeOps: AnyRef with
208208
extension (range: Range):
209209
def hasLength = range.endLine > range.startLine || range.endCharacter > range.startCharacter
210210
end RangeOps
211211

212212
/** Sort symbol occurrences by their start position. */
213-
given OccurrenceOrdering as Ordering[SymbolOccurrence] = (x, y) =>
213+
given OccurrenceOrdering: Ordering[SymbolOccurrence] = (x, y) =>
214214
x.range -> y.range match
215215
case None -> _ | _ -> None => 0
216216
case Some(a) -> Some(b) =>

compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ object ExplicitOuter {
353353
*/
354354
class OuterOps(val ictx: Context) extends AnyVal {
355355
/** The context of all operations of this class */
356-
given [Dummy] as Context = ictx
356+
given [Dummy]: Context = ictx
357357

358358
/** If `cls` has an outer parameter add one to the method type `tp`. */
359359
def addParam(cls: ClassSymbol, tp: Type): Type =

0 commit comments

Comments
 (0)