Skip to content

Commit 37cff3f

Browse files
Merge pull request #92 from dotty-staging/dotty-community-build
Bump Dotty to 0.27.0-RC1
2 parents 4924298 + 1465dab commit 37cff3f

File tree

3 files changed

+20
-25
lines changed

3 files changed

+20
-25
lines changed

build.sc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ trait SourcecodeTestModule extends ScalaModule {
6565

6666
object sourcecode extends Module {
6767
val dottyVersion = Option(sys.props("dottyVersion"))
68-
object jvm extends Cross[JvmSourcecodeModule]((List("2.11.12", "2.12.8", "2.13.0", "0.26.0-RC1") ++ dottyVersion): _*)
68+
object jvm extends Cross[JvmSourcecodeModule]((List("2.11.12", "2.12.8", "2.13.0", "0.27.0-RC1") ++ dottyVersion): _*)
6969
class JvmSourcecodeModule(val crossScalaVersion: String)
7070
extends SourcecodeMainModule with ScalaModule with SourcecodeModule {
7171

sourcecode/src-0/sourcecode/Macros.scala

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ object Macros {
101101
findOwner(c)(owner, c => owner0 => {import c.{given _}; owner0.flags.is(c.Flags.Macro) && Util.getName(c)(owner0) == "macro"})
102102

103103
def nameImpl(using ctx: QuoteContext): Expr[Name] = {
104-
import ctx.tasty.{given _}
105-
val owner = actualOwner(ctx.tasty)(ctx.tasty.rootContext.owner)
104+
import ctx.tasty._
105+
val owner = actualOwner(ctx.tasty)(Symbol.currentOwner)
106106
val simpleName = Util.getName(ctx.tasty)(owner)
107107
'{Name(${Expr(simpleName)})}
108108
}
@@ -115,19 +115,19 @@ object Macros {
115115
s
116116

117117
def nameMachineImpl(using ctx: QuoteContext): Expr[Name.Machine] = {
118-
import ctx.tasty.{given _}
119-
val owner = nonMacroOwner(ctx.tasty)(ctx.tasty.rootContext.owner)
118+
import ctx.tasty._
119+
val owner = nonMacroOwner(ctx.tasty)(Symbol.currentOwner)
120120
val simpleName = adjustName(Util.getName(ctx.tasty)(owner))
121121
'{Name.Machine(${Expr(simpleName)})}
122122
}
123123

124124
def fullNameImpl(using ctx: QuoteContext): Expr[FullName] = {
125-
import ctx.tasty.{given _}
125+
import ctx.tasty._
126126
@annotation.tailrec def cleanChunk(chunk: String): String =
127127
val refined = chunk.stripPrefix("_$").stripSuffix("$")
128128
if chunk != refined then cleanChunk(refined) else refined
129129

130-
val owner = actualOwner(ctx.tasty)(ctx.tasty.rootContext.owner)
130+
val owner = actualOwner(ctx.tasty)(Symbol.currentOwner)
131131
val fullName =
132132
owner.fullName.trim
133133
.split("\\.", -1)
@@ -138,8 +138,8 @@ object Macros {
138138
}
139139

140140
def fullNameMachineImpl(using ctx: QuoteContext): Expr[FullName.Machine] = {
141-
import ctx.tasty.{given _}
142-
val owner = nonMacroOwner(ctx.tasty)(ctx.tasty.rootContext.owner)
141+
import ctx.tasty._
142+
val owner = nonMacroOwner(ctx.tasty)(Symbol.currentOwner)
143143
val fullName = owner.fullName.trim
144144
.split("\\.", -1)
145145
.map(_.stripPrefix("_$").stripSuffix("$")) // meh
@@ -149,19 +149,19 @@ object Macros {
149149
}
150150

151151
def fileImpl(using ctx: QuoteContext): Expr[sourcecode.File] = {
152-
import ctx.tasty.{given _}
152+
import ctx.tasty._
153153
val file = ctx.tasty.rootPosition.sourceFile.jpath.toAbsolutePath.toString
154154
'{sourcecode.File(${Expr(file)})}
155155
}
156156

157157
def fileNameImpl(using ctx: QuoteContext): Expr[sourcecode.FileName] = {
158-
import ctx.tasty.{given _}
158+
import ctx.tasty._
159159
val name = ctx.tasty.rootPosition.sourceFile.jpath.getFileName.toString
160160
'{sourcecode.FileName(${Expr(name)})}
161161
}
162162

163163
def lineImpl(using ctx: QuoteContext): Expr[sourcecode.Line] = {
164-
import ctx.tasty.{given _}
164+
import ctx.tasty._
165165
val line = ctx.tasty.rootPosition.startLine + 1
166166
'{sourcecode.Line(${Expr(line)})}
167167
}
@@ -180,7 +180,7 @@ object Macros {
180180
}
181181

182182
def pkgImpl(using ctx: QuoteContext): Expr[Pkg] = {
183-
import ctx.tasty.{given _}
183+
import ctx.tasty._
184184
val path = enclosing(ctx.tasty) {
185185
case s if s.isPackageDef => true
186186
case _ => false
@@ -190,7 +190,7 @@ object Macros {
190190
}
191191

192192
def argsImpl(using ctx: QuoteContext): Expr[Args] = {
193-
import ctx.tasty.{ _, given _ }
193+
import ctx.tasty._
194194

195195
val param: List[List[ctx.tasty.ValDef]] = {
196196
def nearestEnclosingMethod(owner: ctx.tasty.Symbol): List[List[ctx.tasty.ValDef]] =
@@ -203,7 +203,7 @@ object Macros {
203203
nearestEnclosingMethod(owner.owner)
204204
}
205205

206-
nearestEnclosingMethod(ctx.tasty.rootContext.owner)
206+
nearestEnclosingMethod(Symbol.currentOwner)
207207
}
208208

209209
val texts0 = param.map(_.foldRight('{List.empty[Text[_]]}) {
@@ -220,7 +220,7 @@ object Macros {
220220

221221

222222
def text[T: Type](v: Expr[T])(using ctx: QuoteContext): Expr[sourcecode.Text[T]] = {
223-
import ctx.tasty.{given _}
223+
import ctx.tasty._
224224
val txt = v.unseal.pos.sourceCode
225225
'{sourcecode.Text[T]($v, ${Expr(txt)})}
226226
}
@@ -234,9 +234,9 @@ object Macros {
234234
}
235235

236236
def enclosing(c: Reflection, machine: Boolean = false)(filter: c.Symbol => Boolean): String = {
237-
import c.{ _, given _ }
237+
import c._
238238

239-
var current = c.rootContext.owner
239+
var current = Symbol.currentOwner
240240
if (!machine)
241241
current = actualOwner(c)(current)
242242
else

sourcecode/test/src/sourcecode/TextTests.scala

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@ object TextTests {
55
assert(foo(1) == (1, "1"))
66
val bar = Seq("lols")
77
assert(foo(bar) == (Seq("lols"), "bar"))
8-
if (TestUtil.isDotty) {
9-
assert(foo(Symbol("lol").toString * 2) == ("""Symbol(lol)Symbol(lol)""", "Symbol(\"lol\").toString * 2"))
10-
assert(foo{println("Hello"); Symbol("lol").toString * 2} == ("""Symbol(lol)Symbol(lol)""", "Symbol(\"lol\").toString * 2"))
11-
} else {
12-
assert(foo(Symbol("lol").toString * 2) == ("'lol'lol", "Symbol(\"lol\").toString * 2"))
13-
assert(foo{println("Hello"); Symbol("lol").toString * 2} == ("'lol'lol", "Symbol(\"lol\").toString * 2"))
14-
}
8+
assert(foo(List("lol").toString * 2) == ("List(lol)List(lol)", "List(\"lol\").toString * 2"))
9+
assert(foo{println("Hello"); List("lol").toString * 2} == ("List(lol)List(lol)", "List(\"lol\").toString * 2"))
1510
}
1611
def foo[T](v: sourcecode.Text[T]) = (v.value, v.source)
1712
}

0 commit comments

Comments
 (0)