@@ -5,7 +5,7 @@ import dotty.tools.dotc.core.Contexts
5
5
import dotty .tools .dotc .core .Decorators ._
6
6
import dotty .tools .dotc .core .StdNames .nme
7
7
8
- trait PatternOpsImpl extends scala.tasty.reflect.PatternOps with CoreImpl {
8
+ trait PatternOpsImpl extends scala.tasty.reflect.PatternOps with RootPositionImpl {
9
9
10
10
def ValueDeco (value : Value ): Pattern .ValueAPI = new Pattern .ValueAPI {
11
11
def value (implicit ctx : Context ): Term = value
@@ -74,7 +74,7 @@ trait PatternOpsImpl extends scala.tasty.reflect.PatternOps with CoreImpl {
74
74
object Bind extends BindModule {
75
75
76
76
def copy (original : Bind )(name : String , pattern : Pattern )(implicit ctx : Context ): Bind =
77
- tpd.cpy.Bind (original)(name.toTermName, pattern)
77
+ withDefaultPos(ctx => tpd.cpy.Bind (original)(name.toTermName, pattern)(ctx) )
78
78
79
79
def unapply (pattern : Pattern )(implicit ctx : Context ): Option [(String , Pattern )] = pattern match {
80
80
case IsBind (pattern) => Some ((pattern.name.toString, pattern.body))
@@ -93,7 +93,7 @@ trait PatternOpsImpl extends scala.tasty.reflect.PatternOps with CoreImpl {
93
93
object Unapply extends UnapplyModule {
94
94
95
95
def copy (original : Unapply )(fun : Term , implicits : List [Term ], patterns : List [Pattern ])(implicit ctx : Context ): Unapply =
96
- tpd.cpy.UnApply (original)(fun, implicits, patterns)
96
+ withDefaultPos(ctx => tpd.cpy.UnApply (original)(fun, implicits, patterns)(ctx) )
97
97
98
98
def unapply (x : Pattern )(implicit ctx : Context ): Option [(Term , List [Term ], List [Pattern ])] = x match {
99
99
case IsUnapply (x) => Some ((x.fun, x.implicits, UnapplyDeco (x).patterns))
@@ -110,7 +110,7 @@ trait PatternOpsImpl extends scala.tasty.reflect.PatternOps with CoreImpl {
110
110
111
111
object Alternatives extends AlternativesModule {
112
112
def apply (patterns : List [Pattern ])(implicit ctx : Context ): Alternatives =
113
- tpd.Alternative (patterns)
113
+ withDefaultPos(ctx => tpd.Alternative (patterns)(ctx) )
114
114
115
115
def copy (original : Alternatives )(patterns : List [Pattern ])(implicit ctx : Context ): Alternatives =
116
116
tpd.cpy.Alternative (original)(patterns)
@@ -131,10 +131,10 @@ trait PatternOpsImpl extends scala.tasty.reflect.PatternOps with CoreImpl {
131
131
132
132
object TypeTest extends TypeTestModule {
133
133
def apply (tpt : TypeTree )(implicit ctx : Context ): TypeTest =
134
- tpd.Typed (untpd.Ident (nme.WILDCARD ). withType(tpt.tpe), tpt)
134
+ withDefaultPos(ctx => tpd.Typed (untpd.Ident (nme.WILDCARD )(ctx.source). withType(tpt.tpe)(ctx) , tpt)(ctx) )
135
135
136
136
def copy (original : TypeTest )(tpt : TypeTree )(implicit ctx : Context ): TypeTest =
137
- tpd.cpy.Typed (original)(untpd.Ident (nme.WILDCARD ).withType(tpt.tpe), tpt)
137
+ tpd.cpy.Typed (original)(untpd.Ident (nme.WILDCARD ).withSpan(original.span). withType(tpt.tpe), tpt)
138
138
139
139
def unapply (x : Pattern )(implicit ctx : Context ): Option [TypeTree ] = x match {
140
140
case Trees .Typed (Trees .UnApply (_, _, _), _) => None
0 commit comments