Skip to content

Commit a44086c

Browse files
committed
Update extension method syntax
1 parent ed2f633 commit a44086c

File tree

14 files changed

+53
-48
lines changed

14 files changed

+53
-48
lines changed
Submodule shapeless added at 63c5e0a

tasty/src/dotty/tools/tasty/experimental/bridge/AnnotationOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ trait AnnotationOps extends Core with
1313

1414
def unapply(annot: Annotation)(given Context): Option[Symbol] = internal.Annotation_Child_unapply(annot)
1515

16-
given AnnotationOps: (annot: Annotation) with
16+
given AnnotationOps: (annot: Annotation) extended with
1717
def tree(given Context): tpd.Tree = internal.Annotation_tree(annot)
1818
def symbol(given Context): Symbol = internal.Annotation_symbol(annot)

tasty/src/dotty/tools/tasty/experimental/bridge/CommentOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import reflect.ClassTag
44

55
trait CommentOps extends Core with
66

7-
given CommentOps: (comment: Comment) with
7+
given CommentOps: (comment: Comment) extended with
88
def raw: String = internal.Comment_raw(comment)
99
def span: Span = internal.Comment_span(comment)

tasty/src/dotty/tools/tasty/experimental/bridge/ConstantOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ trait ConstantOps extends Core with
2121
final val EnumTag = internal.Constants_EnumTag
2222
end Constants
2323

24-
given ConstantOps: (c: Constant) with
24+
given ConstantOps: (c: Constant) extended with
2525
def tag: Int = internal.Constant_tag(c)
2626
def intValue: Int = internal.Constant_intValue(c)
2727
def booleanValue: Boolean = internal.Constant_booleanValue(c)

tasty/src/dotty/tools/tasty/experimental/bridge/ContextOps.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import java.nio.file.Path
55

66
trait ContextOps extends Core with
77

8-
given ContextOps: (ctx: Context) with
8+
given ContextOps: (ctx: Context) extended with
99
def log(msg: => String, sourcePos: SourcePosition): Unit = internal.Context_log(ctx, msg, sourcePos)
1010
def source: SourceFile = internal.Context_source(ctx)
1111
def docCtx: Option[ContextDocstrings] = internal.Context_docCtx(ctx)
1212
def withOwner(owner: Symbol): Context = internal.Context_withOwner(ctx, owner)
1313
def withSource(source: SourceFile): Context = internal.Context_withSource(ctx, source)
1414

15-
given ContextDocstringsOps: (ctx: ContextDocstrings) with
15+
given ContextDocstringsOps: (ctx: ContextDocstrings) extended with
1616
def docstring(sym: Symbol): Option[Comment] = internal.ContextDocstrings_docstring(ctx, sym)

tasty/src/dotty/tools/tasty/experimental/bridge/FlagOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ trait FlagOps extends Core with
4343
val Open: Flag = internal.Flags_Open
4444
end Flags
4545

46-
given FlagSetOps: (flags: FlagSet)
46+
given FlagSetOps: (flags: FlagSet) extended with
4747
def is(flag: Flag): Boolean = internal.FlagSet_is(flags, flag)
4848
def is(flag: Flag, butNot: FlagSet): Boolean = internal.FlagSet_is(flags, flag, butNot)
4949
def &~(flag: Flag): FlagSet = internal.FlagSet_&~(flags, flag)

tasty/src/dotty/tools/tasty/experimental/bridge/NameOps.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ trait NameOps extends Core with
3535
def unapply(name: DerivedName): Option[(TermName, Int)] = internal.OuterSelectName_unapply(name)
3636

3737

38-
given NameOps: (name: Name) with
38+
given NameOps: (name: Name) extended with
3939
def toTermName: TermName = internal.Name_toTermName(name)
4040
def isEmpty: Boolean = internal.Name_isEmpty(name)
4141
def isTypeName: Boolean = internal.Name_isTypeName(name)
4242
def isTermName: Boolean = !name.isTypeName
4343

44-
given TermNameOps: (name: TermName) with
44+
given TermNameOps: (name: TermName) extended with
4545
def tag: Int = internal.TermName_tag(name)
4646

47-
given SimpleNameOps: (name: SimpleName) with
47+
given SimpleNameOps: (name: SimpleName) extended with
4848
def toUTF8: Array[Byte] = internal.SimpleName_toUTF8(name)

tasty/src/dotty/tools/tasty/experimental/bridge/PositionOps.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ import reflect.ClassTag
44

55
trait PositionOps extends Core with
66

7-
given PositionedOps: (positioned: Positioned) with
7+
given PositionedOps: (positioned: Positioned) extended with
88

99
/** True if x's position shouldn't be reconstructed automatically from its initial span
1010
*/
1111
def alwaysNeedsPos: Boolean = internal.Positioned_alwaysNeedsPos(positioned)
1212

13-
given SourcePositionOps: (pos: SourcePosition) with
13+
given SourcePositionOps: (pos: SourcePosition) extended with
1414
def line: Int = internal.SourcePosition_line(pos)
1515

1616
object Span with
1717
val empty: Span = internal.Span_empty
1818
val noSpan: Span = internal.Span_noSpan
1919

20-
given SpanOps: (span: Span) with
20+
given SpanOps: (span: Span) extended with
2121
def coords: Long = internal.Span_coords(span)
2222
def isSynthetic: Boolean = internal.Span_isSynthetic(span)
2323
def toSynthetic: Span = internal.Span_toSynthetic(span)

tasty/src/dotty/tools/tasty/experimental/bridge/SignatureOps.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ trait SignatureOps extends Core with
1414

1515
def unapply(signature: Signature): (List[ParamSig], TypeName) = internal.Signature_unapply(signature)
1616

17-
given ParamSigOps: (paramSig: ParamSig) with
17+
given ParamSigOps: (paramSig: ParamSig) extended with
1818
def fold[A](onInt: Int => A, onTypeName: TypeName => A): A = internal.Signature_ParamSig_fold(paramSig)(onInt, onTypeName)
1919
def foldInt(onInt: IntToInt, onTypeName: ToInt[TypeName]): Int = internal.Signature_ParamSig_foldInt(paramSig)(onInt, onTypeName)
2020

2121
end Signature
2222

23-
given SignatureOps: (signature: Signature) with
23+
given SignatureOps: (signature: Signature) extended with
2424
def isNotAMethod: Boolean = internal.Signature_isNotAMethod(signature)

tasty/src/dotty/tools/tasty/experimental/bridge/SourceFileOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ trait SourceFileOps extends Core with
77
object SourceFile with
88
val noSource: SourceFile = internal.SourceFile_noSource
99

10-
given SourceFileOps: (source: SourceFile) with
10+
given SourceFileOps: (source: SourceFile) extended with
1111
def path: String = internal.SourceFile_path(source)
1212
def exists: Boolean = internal.SourceFile_exists(source)

tasty/src/dotty/tools/tasty/experimental/bridge/StringOps.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import reflect.ClassTag
44

55
trait StringOps extends Core with
66

7-
given StringOps: (string: String) with
7+
given StringOps: (string: String) extended with
88
def toTermName: TermName = internal.String_toTermName(string)
99

10-
given StringContextOps: (stringContext: StringContext) with
10+
given StringContextOps: (stringContext: StringContext) extended with
1111
def i(args: => Any*)(given Context): String = internal.StringContext_i(stringContext, args)

tasty/src/dotty/tools/tasty/experimental/bridge/SymbolOps.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ trait SymbolOps extends Core with
1717

1818
def newMutableSymbolMap[T]: MutableSymbolMap[T] = internal.Symbols_newMutableSymbolMap[T]
1919

20-
given MutableSymbolMapOps: [T](map: Symbols.MutableSymbolMap[T]) with
20+
given MutableSymbolMapOps: [T](map: Symbols.MutableSymbolMap[T]) extended with
2121
def get(sym: Symbol): Option[T] = internal.Symbols_MutableSymbolMap_get(map, sym)
22-
def getOrElse[U >: T](sym: Symbol, default: => U): U = internal.Symbols_MutableSymbolMap_getOrElse(map, sym, default)
2322
def contains(sym: Symbol): Boolean = internal.Symbols_MutableSymbolMap_contains(map, sym)
2423
def update(sym: Symbol, value: T): Unit = internal.Symbols_MutableSymbolMap_update(map, sym, value)
2524
def -=(sym: Symbol): Unit = internal.Symbols_MutableSymbolMap_-=(map, sym)
@@ -28,9 +27,14 @@ trait SymbolOps extends Core with
2827
def keysIterator: Iterator[Symbol] = internal.Symbols_MutableSymbolMap_keysIterator(map)
2928
end MutableSymbolMapOps
3029

30+
given MutableSymbolMapOpsPlus: AnyRef with
31+
def [T, U >: T](map: Symbols.MutableSymbolMap[T]) getOrElse(sym: Symbol, default: => U): U =
32+
internal.Symbols_MutableSymbolMap_getOrElse(map, sym, default)
33+
end MutableSymbolMapOpsPlus
34+
3135
end Symbols
3236

33-
given SymbolOps: (sym: Symbol) with
37+
given SymbolOps: (sym: Symbol) extended with
3438
def isPackage(given Context): Boolean = internal.Symbol_isPackage(sym)
3539
def isPrivate(given Context): Boolean = internal.Symbol_isPrivate(sym)
3640
def sourcePos(given Context): SourcePosition = internal.Symbol_sourcePos(sym)

tasty/src/dotty/tools/tasty/experimental/bridge/TreeOps.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,44 +195,44 @@ trait TreeOps extends Core with
195195
object Ident with
196196
def unapply(tree: Ident): Some[Name] = internal.untpd_Ident_unapply(tree)
197197

198-
given ImportSelectorOps: (tree: ImportSelector) with
198+
given ImportSelectorOps: (tree: ImportSelector) extended with
199199
def imported: Ident = internal.ImportSelector_imported(tree)
200200
def renamed: Tree = internal.ImportSelector_renamed(tree)
201201
def bound: Tree = internal.ImportSelector_bound(tree)
202202

203203
end untpd
204204

205-
given untpdTreeOps: (tree: untpd.Tree) with
205+
given untpdTreeOps: (tree: untpd.Tree) extended with
206206
def symbol(given Context): Symbol = internal.untpd_Tree_symbol(tree)
207207
def span: Span = internal.untpd_Tree_span(tree)
208208
def source: SourceFile = internal.untpd_Tree_source(tree)
209209
def envelope(src: SourceFile, startSpan: Span = Span.noSpan): Span = internal.untpd_Tree_envelope(tree, src, startSpan)
210210
def withType(tpe: Type)(given Context): tpd.Tree = internal.untpd_Tree_withType(tree, tpe)
211211
def isEmpty: Boolean = internal.untpd_Tree_isEmpty(tree)
212212

213-
given TreeOps: (tree: tpd.Tree) with
213+
given TreeOps: (tree: tpd.Tree) extended with
214214
def isType: Boolean = internal.Tree_isType(tree)
215215
def tpe: Type = internal.Tree_tpe(tree)
216216

217-
given IfOps: (tree: tpd.If) with
217+
given IfOps: (tree: tpd.If) extended with
218218
def isInline: Boolean = internal.If_isInline(tree)
219219

220-
given MatchOps: (tree: tpd.Match) with
220+
given MatchOps: (tree: tpd.Match) extended with
221221
def isInline: Boolean = internal.Match_isInline(tree)
222222

223-
given ValOrDefDefOps: (tree: tpd.ValOrDefDef) with
223+
given ValOrDefDefOps: (tree: tpd.ValOrDefDef) extended with
224224
def name: TermName = internal.ValOrDefDef_name(tree)
225225
def tpt: tpd.Tree = internal.ValOrDefDef_tpt(tree)
226226
def rhs(given Context): tpd.Tree = internal.ValOrDefDef_rhs(tree)
227227

228-
given DefDefOps: (tree: tpd.DefDef) with
228+
given DefDefOps: (tree: tpd.DefDef) extended with
229229
def tparams: List[tpd.TypeDef] = internal.DefDef_tparams(tree)
230230
def vparamss: List[List[tpd.ValDef]] = internal.DefDef_vparamss(tree)
231231

232-
given TypeDefOps: (tree: tpd.TypeDef) with
232+
given TypeDefOps: (tree: tpd.TypeDef) extended with
233233
def rhs: tpd.Tree = internal.TypeDef_rhs(tree)
234234

235-
given TemplateOps: (tree: tpd.Template) with
235+
given TemplateOps: (tree: tpd.Template) extended with
236236
def decomposeBody(given Context): (List[tpd.Tree], List[tpd.Tree]) = internal.Template_decomposeBody(tree)
237237
def parents: List[tpd.Tree] = internal.Template_parents(tree)
238238
def self: tpd.ValDef = internal.Template_self(tree)

tasty/src/dotty/tools/tasty/experimental/bridge/TypeOps.scala

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ trait TypeOps extends Core with
3333
object AppliedType with
3434
def unapply(tpe: AppliedType): (Type, List[Type]) = internal.AppliedType_unapply(tpe)
3535

36-
given TypeOps: (tpe: Type) with
36+
given TypeOps: (tpe: Type) extended with
3737
def stripTypeVar(given Context): Type = internal.Type_stripTypeVar(tpe)
3838
def signature(given Context): Signature = internal.Type_signature(tpe)
3939
def member(name: Name)(given Context): Symbol = internal.Type_member(tpe, name)
@@ -42,71 +42,71 @@ trait TypeOps extends Core with
4242
def isErasedMethod: Boolean = internal.Type_isErasedMethod(tpe)
4343
def exists: Boolean = internal.Type_exists(tpe)
4444

45-
given ConstantTypeOps: (tpe: ConstantType) with
45+
given ConstantTypeOps: (tpe: ConstantType) extended with
4646
def value: Constant = internal.ConstantType_value(tpe)
4747

48-
given SuperTypeOps: (tpe: SuperType) with
48+
given SuperTypeOps: (tpe: SuperType) extended with
4949
def thistpe: Type = internal.SuperType_thistpe(tpe)
5050
def supertpe: Type = internal.SuperType_supertpe(tpe)
5151

52-
given ThisTypeOps: (tpe: ThisType) with
52+
given ThisTypeOps: (tpe: ThisType) extended with
5353
def cls(given Context): ClassSymbol = internal.ThisType_cls(tpe)
5454
def tref: TypeRef = internal.ThisType_tref(tpe)
5555

56-
given SkolemTypeOps: (tpe: SkolemType) with
56+
given SkolemTypeOps: (tpe: SkolemType) extended with
5757
def info: Type = internal.SkolemType_info(tpe)
5858

59-
given BoundTypeOps: (tpe: BoundType) with
59+
given BoundTypeOps: (tpe: BoundType) extended with
6060
def binder: tpe.BT = internal.BoundType_binder(tpe)
6161

62-
given ParamRefOps: (tpe: ParamRef) with
62+
given ParamRefOps: (tpe: ParamRef) extended with
6363
def paramNum: Int = internal.ParamRef_paramNum(tpe)
6464

65-
given RecTypeOps: (tpe: RecType) with
65+
given RecTypeOps: (tpe: RecType) extended with
6666
def parent: Type = internal.RecType_parent(tpe)
6767

68-
given RefinedTypeOps: (tpe: RefinedType) with
68+
given RefinedTypeOps: (tpe: RefinedType) extended with
6969
def parent: Type = internal.RefinedType_parent(tpe)
7070
def refinedInfo: Type = internal.RefinedType_refinedInfo(tpe)
7171
def refinedName: Name = internal.RefinedType_refinedName(tpe)
7272

73-
given TypeBoundsOps: (tpe: TypeBounds) with
73+
given TypeBoundsOps: (tpe: TypeBounds) extended with
7474
def hi: Type = internal.TypeBounds_hi(tpe)
7575
def lo: Type = internal.TypeBounds_lo(tpe)
7676

77-
given TypeAliasOps: (tpe: TypeAlias) with
77+
given TypeAliasOps: (tpe: TypeAlias) extended with
7878
def alias: Type = internal.TypeAlias_alias(tpe)
7979

80-
given NamedTypeOps: (tpe: NamedType) with
80+
given NamedTypeOps: (tpe: NamedType) extended with
8181
def symbol(given Context): Symbol = internal.NamedType_symbol(tpe)
8282
def prefix: Type = internal.NamedType_prefix(tpe)
8383
def designator: Designator = internal.NamedType_designator(tpe)
8484
def hasNoPrefix: Boolean = internal.NamedType_hasNoPrefix(tpe)
8585
def isType: Boolean = internal.NamedType_isType(tpe)
8686

87-
given AnnotatedTypeOps: (tpe: AnnotatedType) with
87+
given AnnotatedTypeOps: (tpe: AnnotatedType) extended with
8888
def parent: Type = internal.AnnotatedType_parent(tpe)
8989
def annot: Annotation = internal.AnnotatedType_annot(tpe)
9090

91-
given AndOrTypeOps: (tpe: AndOrType) with
91+
given AndOrTypeOps: (tpe: AndOrType) extended with
9292
def tp1: Type = internal.AndOrType_tp1(tpe)
9393
def tp2: Type = internal.AndOrType_tp2(tpe)
9494

95-
given TypeProxyOps: (tpe: TypeProxy) with
95+
given TypeProxyOps: (tpe: TypeProxy) extended with
9696
def underlying(given Context): Type = internal.TypeProxy_underlying(tpe)
9797

98-
given MatchTypeOps: (tpe: MatchType) with
98+
given MatchTypeOps: (tpe: MatchType) extended with
9999
def bound: Type = internal.MatchType_bound(tpe)
100100
def scrutinee: Type = internal.MatchType_scrutinee(tpe)
101101
def cases: List[Type] = internal.MatchType_cases(tpe)
102102

103-
given LambdaTypeOps: (tpe: LambdaType) with
103+
given LambdaTypeOps: (tpe: LambdaType) extended with
104104
def resultType(given Context): Type = internal.LambdaType_resultType(tpe)
105105
def paramNames: List[tpe.ThisName] = internal.LambdaType_paramNames(tpe)
106106
def paramInfos: List[tpe.PInfo] = internal.LambdaType_paramInfos(tpe)
107107

108-
given LazyRefOps: (tpe: LazyRef) with
108+
given LazyRefOps: (tpe: LazyRef) extended with
109109
def ref(given Context): Type = internal.LazyRef_ref(tpe)
110110

111-
given ClassInfoOps: (tpe: ClassInfo) with
111+
given ClassInfoOps: (tpe: ClassInfo) extended with
112112
def selfInfo: Either[Type, Symbol] = internal.ClassInfo_selfInfo(tpe)

0 commit comments

Comments
 (0)