From f49baed3f88abf2002f7ef5c5fdc901d43901d11 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Wed, 17 Feb 2021 11:25:14 +0100 Subject: [PATCH] Update Scala to 3.0.0-RC1 --- build.sc | 2 +- sourcecode/src-3/sourcecode/Macros.scala | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/build.sc b/build.sc index c2b7d32..d50ee48 100644 --- a/build.sc +++ b/build.sc @@ -2,7 +2,7 @@ import mill._, scalalib._, scalajslib._, scalanativelib._, publish._ val dottyVersions = sys.props.get("dottyVersion").toList -val scalaVersions = "2.11.12" :: "2.12.13" :: "2.13.4" :: "3.0.0-M3" :: dottyVersions +val scalaVersions = "2.11.12" :: "2.12.13" :: "2.13.4" :: "3.0.0-RC1" :: dottyVersions val scala2Versions = scalaVersions.filter(_.startsWith("2.")) val scalaJSVersions = for { diff --git a/sourcecode/src-3/sourcecode/Macros.scala b/sourcecode/src-3/sourcecode/Macros.scala index 8bc8ad5..5880678 100644 --- a/sourcecode/src-3/sourcecode/Macros.scala +++ b/sourcecode/src-3/sourcecode/Macros.scala @@ -189,8 +189,14 @@ object Macros { owner match { case defSym if defSym.isDefDef => defSym.tree.asInstanceOf[DefDef].paramss + // FIXME Could be a List[TypeDef] too, although I'm not + // sure under which conditions this can happen… + .map(_.asInstanceOf[List[ValDef]]) case classSym if classSym.isClassDef => classSym.tree.asInstanceOf[ClassDef].constructor.paramss + // FIXME Could be a List[TypeDef] too, although I'm not + // sure under which conditions this can happen… + .map(_.asInstanceOf[List[ValDef]]) case _ => nearestEnclosingMethod(owner.owner) } @@ -213,7 +219,7 @@ object Macros { def text[T: Type](v: Expr[T])(using Quotes): Expr[sourcecode.Text[T]] = { import quotes.reflect._ - val txt = Term.of(v).pos.sourceCode.get + val txt = v.asTerm.pos.sourceCode.get '{sourcecode.Text[T]($v, ${Expr(txt)})} }