diff options
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/annotated-treecopy/Impls_Macros_1.scala | 5 | ||||
-rw-r--r-- | test/files/pos/attachments-typed-another-ident/Impls_1.scala | 7 | ||||
-rw-r--r-- | test/files/pos/attachments-typed-ident/Impls_1.scala | 7 | ||||
-rw-r--r-- | test/files/pos/t1957.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t8013/inpervolator_1.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t8187.check | 0 | ||||
-rw-r--r-- | test/files/pos/t8187.scala | 6 |
7 files changed, 19 insertions, 10 deletions
diff --git a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala index fdf9c72c31..79edbfffd8 100644 --- a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala +++ b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala @@ -15,6 +15,7 @@ object Macros { def tree_impl[T:c.WeakTypeTag,U:c.WeakTypeTag](c: Context) (f:c.Expr[Function1[T,U]]): c.Expr[Function1[T,U]] = { import c.universe._ + import internal._ val ttag = c.weakTypeTag[U] f match { case Expr(Function(List(ValDef(_,n,tp,_)),b)) => @@ -22,7 +23,7 @@ object Macros { var b1 = new Transformer { override def transform(tree: Tree): Tree = tree match { case Ident(x) if (x==n) => Ident(TermName("_arg")) - case tt: TypeTree if tt.original != null => TypeTree(tt.tpe) setOriginal transform(tt.original) + case tt: TypeTree if tt.original != null => setOriginal(TypeTree(tt.tpe), transform(tt.original)) // without the fix to LazyTreeCopier.Annotated, we would need to uncomment the line below to make the macro work // that's because the pattern match in the input expression gets expanded into Typed(<x>, TypeTree(<Int @unchecked>)) // with the original of the TypeTree being Annotated(<@unchecked>, Ident(<x>)) @@ -34,7 +35,7 @@ object Macros { } }.transform(b) - val reifiedTree = c.reifyTree(treeBuild.mkRuntimeUniverseRef, EmptyTree, b1) + val reifiedTree = c.reifyTree(gen.mkRuntimeUniverseRef, EmptyTree, b1) val reifiedExpr = c.Expr[scala.reflect.runtime.universe.Expr[T => U]](reifiedTree) val template = c.universe.reify(new (T => U) with TypedFunction { diff --git a/test/files/pos/attachments-typed-another-ident/Impls_1.scala b/test/files/pos/attachments-typed-another-ident/Impls_1.scala index 8016143a4c..98062a9c76 100644 --- a/test/files/pos/attachments-typed-another-ident/Impls_1.scala +++ b/test/files/pos/attachments-typed-another-ident/Impls_1.scala @@ -6,10 +6,11 @@ object MyAttachment object Macros { def impl(c: Context) = { import c.universe._ - val ident = Ident(TermName("bar")) updateAttachment MyAttachment - assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments) + import internal._ + val ident = updateAttachment(Ident(TermName("bar")), MyAttachment) + assert(attachments(ident).get[MyAttachment.type].isDefined, attachments(ident)) val typed = c.typecheck(ident) - assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments) + assert(attachments(typed).get[MyAttachment.type].isDefined, attachments(typed)) c.Expr[Int](typed) } diff --git a/test/files/pos/attachments-typed-ident/Impls_1.scala b/test/files/pos/attachments-typed-ident/Impls_1.scala index af2cc59ecd..25c0891880 100644 --- a/test/files/pos/attachments-typed-ident/Impls_1.scala +++ b/test/files/pos/attachments-typed-ident/Impls_1.scala @@ -6,10 +6,11 @@ object MyAttachment object Macros { def impl(c: Context) = { import c.universe._ - val ident = Ident(TermName("bar")) updateAttachment MyAttachment - assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments) + import internal._ + val ident = updateAttachment(Ident(TermName("bar")), MyAttachment) + assert(attachments(ident).get[MyAttachment.type].isDefined, attachments(ident)) val typed = c.typecheck(ident) - assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments) + assert(attachments(typed).get[MyAttachment.type].isDefined, attachments(typed)) c.Expr[Int](typed) } diff --git a/test/files/pos/t1957.scala b/test/files/pos/t1957.scala index f80cf730ed..711ce17deb 100644 --- a/test/files/pos/t1957.scala +++ b/test/files/pos/t1957.scala @@ -23,7 +23,7 @@ object Test { final type commonModuleType = Module {type settingsType = self.settingsType} type selfType >: self.type <: commonModuleType - // BTW: if we use the commented out type declarations, the code compiles successfully + // BTW: if we use the commented out type decls, the code compiles successfully // type gristType = Grist {type settingsType <: self.settingsType; type moduleType <: commonModuleType } val tools: List[Tool {type settingsType = self.settingsType}] diff --git a/test/files/pos/t8013/inpervolator_1.scala b/test/files/pos/t8013/inpervolator_1.scala index 89b7c22709..612e1d727d 100644 --- a/test/files/pos/t8013/inpervolator_1.scala +++ b/test/files/pos/t8013/inpervolator_1.scala @@ -18,7 +18,7 @@ object Perverse { def pImpl(c: Context)(args: c.Expr[Any]*): c.Expr[String] = { import c.universe._ val macroPos = c.macroApplication.pos - val text = macroPos.lineContent substring macroPos.column + val text = macroPos.source.lineToString(macroPos.line - 1) substring macroPos.column val tt = Literal(Constant(text)) val tree = q"t8013.Perverse.pervert($tt)" c.Expr[String](tree) diff --git a/test/files/pos/t8187.check b/test/files/pos/t8187.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/pos/t8187.check diff --git a/test/files/pos/t8187.scala b/test/files/pos/t8187.scala new file mode 100644 index 0000000000..99b10c6260 --- /dev/null +++ b/test/files/pos/t8187.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + val tyn: TypeName = (??? : TypeSymbol).name + val ten: TermName = (??? : TermSymbol).name +}
\ No newline at end of file |