diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala index bf331e2d1440..ca304c2e7aa3 100644 --- a/compiler/src/dotty/tools/dotc/core/Contexts.scala +++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala @@ -599,7 +599,7 @@ object Contexts { def setDebug: this.type = setSetting(base.settings.Ydebug, true) } - given ops: extension (c: Context) with + extension ops on (c: Context) with def addNotNullInfo(info: NotNullInfo) = c.withNotNullInfos(c.notNullInfos.extendWith(info)) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala index 9d2622183391..1cbc90bd8282 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala @@ -67,7 +67,7 @@ object Scala3 with end Symbols - given NameOps: extension (name: Name) with + extension NameOps on (name: Name) with def isWildcard = name match case nme.WILDCARD | WILDCARDTypeName => true @@ -87,9 +87,9 @@ object Scala3 with case _ => false } - end NameOps + // end NameOps - given SymbolOps: extension (sym: Symbol) with + extension SymbolOps on (sym: Symbol) with def ifExists(given Context): Option[Symbol] = if sym.exists then Some(sym) else None @@ -126,7 +126,7 @@ object Scala3 with def isAnnotation(given Context): Boolean = sym.derivesFrom(defn.AnnotationClass) - end SymbolOps + // end SymbolOps object LocalSymbol with @@ -146,7 +146,7 @@ object Scala3 with case '/' | '.' | '#' | ']' | ')' => true case _ => false - given StringOps: extension (symbol: String) with + extension StringOps on (symbol: String) with def isSymbol: Boolean = !symbol.isEmpty def isRootPackage: Boolean = RootPackage == symbol @@ -169,9 +169,9 @@ object Scala3 with def isJavaIdent = isJavaIdentifierStart(symbol.head) && symbol.tail.forall(isJavaIdentifierPart) - end StringOps + // end StringOps - given InfoOps: extension (info: SymbolInformation) with + extension InfoOps on (info: SymbolInformation) with def isAbstract: Boolean = (info.properties & SymbolInformation.Property.ABSTRACT.value) != 0 def isFinal: Boolean = (info.properties & SymbolInformation.Property.FINAL.value) != 0 @@ -205,11 +205,11 @@ object Scala3 with def isTrait: Boolean = info.kind.isTrait def isInterface: Boolean = info.kind.isInterface - end InfoOps + // end InfoOps - given RangeOps: extension (range: Range) with + extension RangeOps on (range: Range) with def hasLength = range.endLine > range.startLine || range.endCharacter > range.startCharacter - end RangeOps + // end RangeOps /** Sort symbol occurrences by their start position. */ given OccurrenceOrdering: Ordering[SymbolOccurrence] = (x, y) => diff --git a/compiler/src/dotty/tools/dotc/typer/Nullables.scala b/compiler/src/dotty/tools/dotc/typer/Nullables.scala index 544c8b49ec98..7f4113bd1486 100644 --- a/compiler/src/dotty/tools/dotc/typer/Nullables.scala +++ b/compiler/src/dotty/tools/dotc/typer/Nullables.scala @@ -160,7 +160,7 @@ object Nullables with // TODO: Add constant pattern if the constant type is not nullable case _ => false - given notNullInfoOps: extension (infos: List[NotNullInfo]) with + extension notNullInfoOps on (infos: List[NotNullInfo]) with /** Do the current not-null infos imply that `ref` is not null? * Not-null infos are as a history where earlier assertions and retractions replace @@ -189,9 +189,9 @@ object Nullables with val mutables = infos.foldLeft(Set[TermRef]())((ms, info) => ms.union(info.asserted.filter(_.symbol.is(Mutable)))) infos.extendWith(NotNullInfo(Set(), mutables)) - end notNullInfoOps + // end notNullInfoOps - given refOps: extension (ref: TermRef) with + extension refOps on (ref: TermRef) with /** Is the use of a mutable variable out of order * @@ -245,7 +245,7 @@ object Nullables with && refOwner.isTerm && recur(curCtx.owner) - given treeOps: extension (tree: Tree) with + extension treeOps on (tree: Tree) with /* The `tree` with added nullability attachment */ def withNotNullInfo(info: NotNullInfo): tree.type = @@ -335,7 +335,7 @@ object Nullables with tree.computeNullable() }.traverse(tree) - given assignOps: extension (tree: Assign) with + extension assignOps on (tree: Assign) with def computeAssignNullable()(given Context): tree.type = tree.lhs match case TrackedRef(ref) => val rhstp = tree.rhs.typeOpt diff --git a/library/src/scala/internal/quoted/Matcher.scala b/library/src/scala/internal/quoted/Matcher.scala index 69c6e73998a6..6da973f04f3c 100644 --- a/library/src/scala/internal/quoted/Matcher.scala +++ b/library/src/scala/internal/quoted/Matcher.scala @@ -96,13 +96,13 @@ private[quoted] object Matcher { case _ => notMatched } - private given treeListOps: extension (scrutinees: List[Tree]) { + private extension treeListOps on (scrutinees: List[Tree]) { /** Check that all trees match with =?= and concatenate the results with && */ def =?= (patterns: List[Tree])(using Context, Env): Matching = matchLists(scrutinees, patterns)(_ =?= _) } - private given treeOps: extension (scrutinee0: Tree) { + private extension treeOps on (scrutinee0: Tree) { /** Check that the trees match and return the contents from the pattern holes. * Return None if the trees do not match otherwise return Some of a tuple containing all the contents in the holes. diff --git a/library/src/scala/tasty/Reflection.scala b/library/src/scala/tasty/Reflection.scala index dfdf138bdb0c..5d4bab741c24 100644 --- a/library/src/scala/tasty/Reflection.scala +++ b/library/src/scala/tasty/Reflection.scala @@ -419,7 +419,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => // QUOTES // //////////////// - given QuotedExprOps: extension (expr: scala.quoted.Expr[?]) { + extension QuotedExprOps on (expr: scala.quoted.Expr[?]) { /** View this expression `quoted.Expr[T]` as a `Term` */ def unseal(using ctx: Context): Term = internal.QuotedExpr_unseal(expr)