diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-02-19 10:37:09 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-02-19 10:37:09 +0100 |
commit | 3973f29cec9f06724941b68577908f546341c45e (patch) | |
tree | f99466561254174a678818fd5bae566bd9742488 /test/files/pos | |
parent | 3dbcb1b9d4daa5cba98747bbc66f898ba0f864fd (diff) | |
parent | 1714578eb8b4526de248c5a62e9aa175c5758b7c (diff) | |
download | scala-3973f29cec9f06724941b68577908f546341c45e.tar.gz scala-3973f29cec9f06724941b68577908f546341c45e.tar.bz2 scala-3973f29cec9f06724941b68577908f546341c45e.zip |
Merge pull request #3452 from xeno-by/topic/palladium0
SI-8063 and its seventy friends
Diffstat (limited to 'test/files/pos')
20 files changed, 708 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/reflection-compat-api-universe.check b/test/files/pos/reflection-compat-api-universe.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/pos/reflection-compat-api-universe.check diff --git a/test/files/pos/reflection-compat-api-universe.scala b/test/files/pos/reflection-compat-api-universe.scala new file mode 100644 index 0000000000..0aee8bcda5 --- /dev/null +++ b/test/files/pos/reflection-compat-api-universe.scala @@ -0,0 +1,136 @@ +object Test extends App { + val u: scala.reflect.api.Universe = ??? + import u._ + import scala.reflect.ClassTag + import compat._ + + val tree: Tree = ??? + val ttree: TypeTree = ??? + val stree: SymTree = ??? + val trees: List[Tree] = ??? + val mods: Modifiers = ??? + val impl: Template = ??? + val vparamss: List[List[ValDef]] = ??? + val rhs: Tree = ??? + val sym: Symbol = ??? + val tsym: TypeSymbol = ??? + val syms: List[Symbol] = ??? + val params: List[Symbol] = ??? + val tparams: List[Symbol] = ??? + val tpe: Type = ??? + val tpes: List[Type] = ??? + val manifest: Manifest[Int] = ??? + val tag: TypeTag[Int] = ??? + val mirror: Mirror = ??? + val decls: Scope = ??? + val pos: Position = ??? + val ann: Annotation = ??? + val anns: List[Annotation] = ??? + val const: Constant = ??? + val name: Name = ??? + val tyname: TypeName = ??? + val tename: TermName = ??? + val flags: FlagSet = ??? + val str: String = ??? + val i: Int = ??? + val b: Boolean = ??? + + // abstract class BuildApi + // abstract class ReferenceToBoxedExtractor + // abstract trait AttachableApi + // abstract trait FreeTermSymbolApi + // abstract trait FreeTypeSymbolApi + // abstract trait IdentContextApi + // abstract trait ReferenceToBoxedApi + // abstract trait SymTreeContextApi + // abstract trait SymbolContextApi + // abstract trait TreeContextApi + // abstract trait TypeTreeContextApi + locally(ClassDef(sym, impl): ClassDef) + locally(DefDef(sym, mods, vparamss, rhs): DefDef) + locally(DefDef(sym, vparamss, rhs): DefDef) + locally(DefDef(sym, mods, rhs): DefDef) + locally(DefDef(sym, rhs): DefDef) + locally(DefDef(sym, (??? : List[List[Symbol]] => Tree)): DefDef) + locally(LabelDef(sym, params, rhs): LabelDef) + locally(ModuleDef(sym, impl): ModuleDef) + locally(TypeDef(sym, rhs): TypeDef) + locally(TypeDef(sym): TypeDef) + locally(ValDef(sym, rhs): ValDef) + locally(ValDef(sym): ValDef) + locally(AnnotatedType(anns, tpe): AnnotatedType) + locally(BoundedWildcardType(??? : TypeBounds): BoundedWildcardType) + locally(TypeBounds(tpe, tpe): TypeBounds) + locally(MethodType(params, tpe): MethodType) + locally(RefinedType(tpes, decls): RefinedType) + locally(RefinedType(tpes, decls, sym): RefinedType) + locally(ClassInfoType(tpes, decls, sym): ClassInfoType) + locally(SingleType(tpe, sym): Type) + locally(TypeRef(tpe, sym, tpes): Type) + locally(ExistentialType(syms, tpe): ExistentialType) + locally(NullaryMethodType(tpe): NullaryMethodType) + locally(ThisType(sym): Type) + locally(SuperType(tpe, tpe): Type) + locally(PolyType(syms, tpe): PolyType) + locally(ConstantType(const): ConstantType) + locally(sym.asFreeTerm: FreeTermSymbol) + locally(sym.asFreeType: FreeTypeSymbol) + locally(existentialAbstraction(tparams, tpe): Type) + locally(tree.freeTerms: List[FreeTermSymbol]) + locally(tree.freeTypes: List[FreeTypeSymbol]) + locally(intersectionType(tpes): Type) + locally(intersectionType(tpes, sym): Type) + locally(sym.isErroneous: Boolean) + locally(sym.isFreeTerm: Boolean) + locally(sym.isFreeType: Boolean) + locally(sym.isLocal: Boolean) + locally(sym.isOverride: Boolean) + locally(tsym.isSkolem: Boolean) + locally(manifestToTypeTag(mirror, manifest): scala.reflect.api.Universe#TypeTag[Int]) + locally(mkImporter(scala.reflect.runtime.universe): Importer{val from: scala.reflect.runtime.universe.type}) + locally(sym.newClassSymbol(tyname, pos, flags): ClassSymbol) + locally(sym.newMethodSymbol(tename, pos, flags): MethodSymbol) + locally(sym.newModuleAndClassSymbol(name, pos, flags): (ModuleSymbol, ClassSymbol)) + locally(newScopeWith(sym, sym, sym): Scope) + locally(sym.newTermSymbol(tename, pos, flags): TermSymbol) + locally(sym.newTypeSymbol(tyname, pos, flags): TypeSymbol) + locally(polyType(tparams, tpe): Type) + locally(sym.pos: Position) + locally(refinedType(tpes, sym): Type) + locally(refinedType(tpes, sym, decls, pos): Type) + locally(singleType(tpe, sym): Type) + locally(tree.substituteSymbols(syms, syms): Tree) + locally(tree.substituteThis(sym, tree): Tree) + locally(tree.substituteTypes(syms, tpes): Tree) + locally(typeRef(tpe, sym, tpes): Type) + locally(typeTagToManifest(mirror, tag): Manifest[Int]) + locally(FreeTermSymbolTag: ClassTag[FreeTermSymbol]) + locally((??? : FreeTermSymbol).origin) + locally((??? : FreeTermSymbol).value) + locally(FreeTypeSymbolTag: ClassTag[FreeTypeSymbol]) + locally((??? : FreeTypeSymbol).origin) + locally(ReferenceToBoxedTag: ClassTag[ReferenceToBoxed]) + locally(build: BuildApi) + locally(ReferenceToBoxed(??? : Ident): ReferenceToBoxed) + locally((??? : ReferenceToBoxed).ident: Tree) + locally(ReferenceToBoxed.unapply(???): Option[Ident]) + locally(build.selectType(sym, str): TypeSymbol) + locally(build.selectTerm(sym, str): TermSymbol) + locally(build.selectOverloadedMethod(sym, str, i): MethodSymbol) + locally(build.newNestedSymbol(sym, name, pos, flags, b): Symbol) + locally(build.newFreeTerm(str, i): FreeTermSymbol) + locally(build.newFreeTerm(str, i, flags, str): FreeTermSymbol) + locally(build.newFreeType(str): FreeTypeSymbol) + locally(build.newFreeType(str, flags, str): FreeTypeSymbol) + locally(build.setTypeSignature(sym, tpe): Symbol) + locally(build.setAnnotations(sym, anns): Symbol) + locally(build.flagsFromBits(??? : Long): FlagSet) + locally(build.emptyValDef: ValDef) + locally(build.This(sym): Tree) + locally(build.Select(tree, sym): Select) + locally(build.Ident(sym): Ident) + locally(build.TypeTree(tpe): TypeTree) + locally(build.thisPrefix(sym): Type) + locally(build.setType(tree, tpe): Tree) + locally(build.setSymbol(tree, sym): Tree) +}
\ No newline at end of file diff --git a/test/files/pos/reflection-compat-c.check b/test/files/pos/reflection-compat-c.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/pos/reflection-compat-c.check diff --git a/test/files/pos/reflection-compat-c.scala b/test/files/pos/reflection-compat-c.scala new file mode 100644 index 0000000000..73158decdc --- /dev/null +++ b/test/files/pos/reflection-compat-c.scala @@ -0,0 +1,139 @@ +import scala.reflect.macros.Context + +object Test extends App { + def impl(c: Context) = { + import c.universe._ + import scala.reflect.ClassTag + import compat._ + + val tree: Tree = ??? + val ttree: TypeTree = ??? + val stree: SymTree = ??? + val trees: List[Tree] = ??? + val mods: Modifiers = ??? + val impl: Template = ??? + val vparamss: List[List[ValDef]] = ??? + val rhs: Tree = ??? + val sym: Symbol = ??? + val tsym: TypeSymbol = ??? + val syms: List[Symbol] = ??? + val params: List[Symbol] = ??? + val tparams: List[Symbol] = ??? + val tpe: Type = ??? + val tpes: List[Type] = ??? + val manifest: Manifest[Int] = ??? + val tag: TypeTag[Int] = ??? + val mirror: Mirror = ??? + val decls: Scope = ??? + val pos: Position = ??? + val ann: Annotation = ??? + val anns: List[Annotation] = ??? + val const: Constant = ??? + val name: Name = ??? + val tyname: TypeName = ??? + val tename: TermName = ??? + val flags: FlagSet = ??? + val str: String = ??? + val i: Int = ??? + val b: Boolean = ??? + + // abstract class BuildApi + // abstract class ReferenceToBoxedExtractor + // abstract trait AttachableApi + // abstract trait FreeTermSymbolApi + // abstract trait FreeTypeSymbolApi + // abstract trait IdentContextApi + // abstract trait ReferenceToBoxedApi + // abstract trait SymTreeContextApi + // abstract trait SymbolContextApi + // abstract trait TreeContextApi + // abstract trait TypeTreeContextApi + locally(ClassDef(sym, impl): ClassDef) + locally(DefDef(sym, mods, vparamss, rhs): DefDef) + locally(DefDef(sym, vparamss, rhs): DefDef) + locally(DefDef(sym, mods, rhs): DefDef) + locally(DefDef(sym, rhs): DefDef) + locally(DefDef(sym, (??? : List[List[Symbol]] => Tree)): DefDef) + locally(LabelDef(sym, params, rhs): LabelDef) + locally(ModuleDef(sym, impl): ModuleDef) + locally(TypeDef(sym, rhs): TypeDef) + locally(TypeDef(sym): TypeDef) + locally(ValDef(sym, rhs): ValDef) + locally(ValDef(sym): ValDef) + locally(AnnotatedType(anns, tpe): AnnotatedType) + locally(BoundedWildcardType(??? : TypeBounds): BoundedWildcardType) + locally(TypeBounds(tpe, tpe): TypeBounds) + locally(MethodType(params, tpe): MethodType) + locally(RefinedType(tpes, decls): RefinedType) + locally(RefinedType(tpes, decls, sym): RefinedType) + locally(ClassInfoType(tpes, decls, sym): ClassInfoType) + locally(SingleType(tpe, sym): Type) + locally(TypeRef(tpe, sym, tpes): Type) + locally(ExistentialType(syms, tpe): ExistentialType) + locally(NullaryMethodType(tpe): NullaryMethodType) + locally(ThisType(sym): Type) + locally(SuperType(tpe, tpe): Type) + locally(PolyType(syms, tpe): PolyType) + locally(ConstantType(const): ConstantType) + locally(sym.asFreeTerm: FreeTermSymbol) + locally(sym.asFreeType: FreeTypeSymbol) + locally(existentialAbstraction(tparams, tpe): Type) + locally(tree.freeTerms: List[FreeTermSymbol]) + locally(tree.freeTypes: List[FreeTypeSymbol]) + locally(intersectionType(tpes): Type) + locally(intersectionType(tpes, sym): Type) + locally(sym.isErroneous: Boolean) + locally(sym.isFreeTerm: Boolean) + locally(sym.isFreeType: Boolean) + locally(sym.isLocal: Boolean) + locally(sym.isOverride: Boolean) + locally(tsym.isSkolem: Boolean) + locally(manifestToTypeTag(mirror, manifest): scala.reflect.api.Universe#TypeTag[Int]) + locally(mkImporter(scala.reflect.runtime.universe): Importer{val from: scala.reflect.runtime.universe.type}) + locally(sym.newClassSymbol(tyname, pos, flags): ClassSymbol) + locally(sym.newMethodSymbol(tename, pos, flags): MethodSymbol) + locally(sym.newModuleAndClassSymbol(name, pos, flags): (ModuleSymbol, ClassSymbol)) + locally(newScopeWith(sym, sym, sym): Scope) + locally(sym.newTermSymbol(tename, pos, flags): TermSymbol) + locally(sym.newTypeSymbol(tyname, pos, flags): TypeSymbol) + locally(polyType(tparams, tpe): Type) + locally(sym.pos: Position) + locally(refinedType(tpes, sym): Type) + locally(refinedType(tpes, sym, decls, pos): Type) + locally(singleType(tpe, sym): Type) + locally(tree.substituteSymbols(syms, syms): Tree) + locally(tree.substituteThis(sym, tree): Tree) + locally(tree.substituteTypes(syms, tpes): Tree) + locally(typeRef(tpe, sym, tpes): Type) + locally(typeTagToManifest(mirror, tag): Manifest[Int]) + locally(FreeTermSymbolTag: ClassTag[FreeTermSymbol]) + locally((??? : FreeTermSymbol).origin) + locally((??? : FreeTermSymbol).value) + locally(FreeTypeSymbolTag: ClassTag[FreeTypeSymbol]) + locally((??? : FreeTypeSymbol).origin) + locally(ReferenceToBoxedTag: ClassTag[ReferenceToBoxed]) + locally(build: BuildApi) + locally(ReferenceToBoxed(??? : Ident): ReferenceToBoxed) + locally((??? : ReferenceToBoxed).ident: Tree) + locally(ReferenceToBoxed.unapply(???): Option[Ident]) + locally(build.selectType(sym, str): TypeSymbol) + locally(build.selectTerm(sym, str): TermSymbol) + locally(build.selectOverloadedMethod(sym, str, i): MethodSymbol) + locally(build.newNestedSymbol(sym, name, pos, flags, b): Symbol) + locally(build.newFreeTerm(str, i): FreeTermSymbol) + locally(build.newFreeTerm(str, i, flags, str): FreeTermSymbol) + locally(build.newFreeType(str): FreeTypeSymbol) + locally(build.newFreeType(str, flags, str): FreeTypeSymbol) + locally(build.setTypeSignature(sym, tpe): Symbol) + locally(build.setAnnotations(sym, anns): Symbol) + locally(build.flagsFromBits(??? : Long): FlagSet) + locally(build.emptyValDef: ValDef) + locally(build.This(sym): Tree) + locally(build.Select(tree, sym): Select) + locally(build.Ident(sym): Ident) + locally(build.TypeTree(tpe): TypeTree) + locally(build.thisPrefix(sym): Type) + locally(build.setType(tree, tpe): Tree) + locally(build.setSymbol(tree, sym): Tree) + } +}
\ No newline at end of file diff --git a/test/files/pos/reflection-compat-macro-universe.check b/test/files/pos/reflection-compat-macro-universe.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/pos/reflection-compat-macro-universe.check diff --git a/test/files/pos/reflection-compat-macro-universe.scala b/test/files/pos/reflection-compat-macro-universe.scala new file mode 100644 index 0000000000..89ca36dab2 --- /dev/null +++ b/test/files/pos/reflection-compat-macro-universe.scala @@ -0,0 +1,177 @@ +object Test extends App { + val u: scala.reflect.macros.Universe = ??? + import u._ + import scala.reflect.macros.Attachments + import scala.reflect.ClassTag + import compat._ + + val tree: Tree = ??? + val ttree: TypeTree = ??? + val stree: SymTree = ??? + val trees: List[Tree] = ??? + val mods: Modifiers = ??? + val impl: Template = ??? + val vparamss: List[List[ValDef]] = ??? + val rhs: Tree = ??? + val sym: Symbol = ??? + val tsym: TypeSymbol = ??? + val syms: List[Symbol] = ??? + val params: List[Symbol] = ??? + val tparams: List[Symbol] = ??? + val tpe: Type = ??? + val tpes: List[Type] = ??? + val manifest: Manifest[Int] = ??? + val tag: TypeTag[Int] = ??? + val mirror: Mirror = ??? + val decls: Scope = ??? + val pos: Position = ??? + val ann: Annotation = ??? + val anns: List[Annotation] = ??? + val const: Constant = ??? + val name: Name = ??? + val tyname: TypeName = ??? + val tename: TermName = ??? + val flags: FlagSet = ??? + val str: String = ??? + val i: Int = ??? + val b: Boolean = ??? + + // abstract class BuildApi + // abstract class ReferenceToBoxedExtractor + // abstract trait AttachableApi + // abstract trait FreeTermSymbolApi + // abstract trait FreeTypeSymbolApi + // abstract trait IdentContextApi + // abstract trait ReferenceToBoxedApi + // abstract trait SymTreeContextApi + // abstract trait SymbolContextApi + // abstract trait TreeContextApi + // abstract trait TypeTreeContextApi + locally(ClassDef(sym, impl): ClassDef) + locally(DefDef(sym, mods, vparamss, rhs): DefDef) + locally(DefDef(sym, vparamss, rhs): DefDef) + locally(DefDef(sym, mods, rhs): DefDef) + locally(DefDef(sym, rhs): DefDef) + locally(DefDef(sym, (??? : List[List[Symbol]] => Tree)): DefDef) + locally(LabelDef(sym, params, rhs): LabelDef) + locally(ModuleDef(sym, impl): ModuleDef) + locally(TypeDef(sym, rhs): TypeDef) + locally(TypeDef(sym): TypeDef) + locally(ValDef(sym, rhs): ValDef) + locally(ValDef(sym): ValDef) + locally(AnnotatedType(anns, tpe): AnnotatedType) + locally(BoundedWildcardType(??? : TypeBounds): BoundedWildcardType) + locally(TypeBounds(tpe, tpe): TypeBounds) + locally(MethodType(params, tpe): MethodType) + locally(RefinedType(tpes, decls): RefinedType) + locally(RefinedType(tpes, decls, sym): RefinedType) + locally(ClassInfoType(tpes, decls, sym): ClassInfoType) + locally(SingleType(tpe, sym): Type) + locally(TypeRef(tpe, sym, tpes): Type) + locally(ExistentialType(syms, tpe): ExistentialType) + locally(NullaryMethodType(tpe): NullaryMethodType) + locally(ThisType(sym): Type) + locally(SuperType(tpe, tpe): Type) + locally(PolyType(syms, tpe): PolyType) + locally(ConstantType(const): ConstantType) + locally(sym.asFreeTerm: FreeTermSymbol) + locally(sym.asFreeType: FreeTypeSymbol) + locally(sym.attachments: Attachments { type Pos = Position }) + locally(tree.attachments: Attachments { type Pos = Position }) + locally(captureVariable(sym): Unit) + locally(capturedVariableType(sym): Type) + locally(sym.deSkolemize: Symbol) + locally(tree.defineType(tpe): Tree) + locally(existentialAbstraction(tparams, tpe): Type) + locally(tree.freeTerms: List[FreeTermSymbol]) + locally(tree.freeTypes: List[FreeTypeSymbol]) + locally(intersectionType(tpes): Type) + locally(intersectionType(tpes, sym): Type) + locally(sym.isErroneous: Boolean) + locally(sym.isFreeTerm: Boolean) + locally(sym.isFreeType: Boolean) + locally(sym.isLocal: Boolean) + locally(sym.isOverride: Boolean) + locally(tsym.isSkolem: Boolean) + locally(manifestToTypeTag(mirror, manifest): scala.reflect.api.Universe#TypeTag[Int]) + locally(treeBuild.mkAttributedIdent(sym): RefTree) + locally(treeBuild.mkAttributedQualifier(tpe): Tree) + locally(treeBuild.mkAttributedQualifier(tpe, sym): Tree) + locally(treeBuild.mkAttributedRef(tpe, sym): RefTree) + locally(treeBuild.mkAttributedRef(sym): RefTree) + locally(treeBuild.mkAttributedSelect(tree, sym): RefTree) + locally(treeBuild.mkAttributedThis(sym): This) + locally(mkImporter(scala.reflect.runtime.universe): Importer{val from: scala.reflect.runtime.universe.type}) + locally(treeBuild.mkMethodCall(sym, trees): Tree) + locally(treeBuild.mkMethodCall(sym, tpes, trees): Tree) + locally(treeBuild.mkMethodCall(sym, name, trees): Tree) + locally(treeBuild.mkMethodCall(sym, name, tpes, trees): Tree) + locally(treeBuild.mkMethodCall(tree, sym, tpes, trees): Tree) + locally(treeBuild.mkMethodCall(tree, trees): Tree) + locally(treeBuild.mkMethodCall(tree, tpes, trees): Tree) + locally(treeBuild.mkNullaryCall(sym, tpes): Tree) + locally(treeBuild.mkRuntimeUniverseRef: Tree) + locally(treeBuild.mkUnattributedRef(name): RefTree) + locally(treeBuild.mkUnattributedRef(sym): RefTree) + locally(sym.newClassSymbol(tyname, pos, flags): ClassSymbol) + locally(sym.newMethodSymbol(tename, pos, flags): MethodSymbol) + locally(sym.newModuleAndClassSymbol(name, pos, flags): (ModuleSymbol, ClassSymbol)) + locally(newScopeWith(sym, sym, sym): Scope) + locally(sym.newTermSymbol(tename, pos, flags): TermSymbol) + locally(sym.newTypeSymbol(tyname, pos, flags): TypeSymbol) + locally(polyType(tparams, tpe): Type) + locally(sym.pos: Position) + locally((tree.pos = pos): Unit) + locally(referenceCapturedVariable(sym): Tree) + locally(refinedType(tpes, sym): Type) + locally(refinedType(tpes, sym, decls, pos): Type) + locally(sym.removeAttachment[Int]: Symbol) + locally(tree.removeAttachment[Int]: Tree) + locally(sym.setAnnotations(ann, ann, ann): Symbol) + locally(sym.setName(name): Symbol) + locally(ttree.setOriginal(tree): TypeTree) + locally(tree.setPos(pos): Tree) + locally(sym.setPrivateWithin(sym): Symbol) + locally(tree.setSymbol(sym): Tree) + locally(tree.setType(tpe): Tree) + locally(sym.setTypeSignature(tpe): Symbol) + locally(singleType(tpe, sym): Type) + locally(tree.substituteSymbols(syms, syms): Tree) + locally(tree.substituteThis(sym, tree): Tree) + locally(tree.substituteTypes(syms, tpes): Tree) + locally((tree.symbol = sym): Unit) + locally((tree.tpe = tpe): Unit) + locally(typeRef(tpe, sym, tpes): Type) + locally(typeTagToManifest(mirror, tag): Manifest[Int]) + locally(sym.updateAttachment(42): Symbol) + locally(tree.updateAttachment(42): Tree) + locally(FreeTermSymbolTag: ClassTag[FreeTermSymbol]) + locally((??? : FreeTermSymbol).origin) + locally((??? : FreeTermSymbol).value) + locally(FreeTypeSymbolTag: ClassTag[FreeTypeSymbol]) + locally((??? : FreeTypeSymbol).origin) + locally(ReferenceToBoxedTag: ClassTag[ReferenceToBoxed]) + locally(build: BuildApi) + locally(ReferenceToBoxed(??? : Ident): ReferenceToBoxed) + locally((??? : ReferenceToBoxed).ident: Tree) + locally(ReferenceToBoxed.unapply(???): Option[Ident]) + locally(build.selectType(sym, str): TypeSymbol) + locally(build.selectTerm(sym, str): TermSymbol) + locally(build.selectOverloadedMethod(sym, str, i): MethodSymbol) + locally(build.newNestedSymbol(sym, name, pos, flags, b): Symbol) + locally(build.newFreeTerm(str, i): FreeTermSymbol) + locally(build.newFreeTerm(str, i, flags, str): FreeTermSymbol) + locally(build.newFreeType(str): FreeTypeSymbol) + locally(build.newFreeType(str, flags, str): FreeTypeSymbol) + locally(build.setTypeSignature(sym, tpe): Symbol) + locally(build.setAnnotations(sym, anns): Symbol) + locally(build.flagsFromBits(??? : Long): FlagSet) + locally(build.emptyValDef: ValDef) + locally(build.This(sym): Tree) + locally(build.Select(tree, sym): Select) + locally(build.Ident(sym): Ident) + locally(build.TypeTree(tpe): TypeTree) + locally(build.thisPrefix(sym): Type) + locally(build.setType(tree, tpe): Tree) + locally(build.setSymbol(tree, sym): Tree) +}
\ No newline at end of file diff --git a/test/files/pos/reflection-compat-ru.check b/test/files/pos/reflection-compat-ru.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/pos/reflection-compat-ru.check diff --git a/test/files/pos/reflection-compat-ru.scala b/test/files/pos/reflection-compat-ru.scala new file mode 100644 index 0000000000..9ff72d1cf0 --- /dev/null +++ b/test/files/pos/reflection-compat-ru.scala @@ -0,0 +1,135 @@ +object Test extends App { + import scala.reflect.runtime.universe._ + import scala.reflect.ClassTag + import compat._ + + val tree: Tree = ??? + val ttree: TypeTree = ??? + val stree: SymTree = ??? + val trees: List[Tree] = ??? + val mods: Modifiers = ??? + val impl: Template = ??? + val vparamss: List[List[ValDef]] = ??? + val rhs: Tree = ??? + val sym: Symbol = ??? + val tsym: TypeSymbol = ??? + val syms: List[Symbol] = ??? + val params: List[Symbol] = ??? + val tparams: List[Symbol] = ??? + val tpe: Type = ??? + val tpes: List[Type] = ??? + val manifest: Manifest[Int] = ??? + val tag: TypeTag[Int] = ??? + val mirror: Mirror = ??? + val decls: Scope = ??? + val pos: Position = ??? + val ann: Annotation = ??? + val anns: List[Annotation] = ??? + val const: Constant = ??? + val name: Name = ??? + val tyname: TypeName = ??? + val tename: TermName = ??? + val flags: FlagSet = ??? + val str: String = ??? + val i: Int = ??? + val b: Boolean = ??? + + // abstract class BuildApi + // abstract class ReferenceToBoxedExtractor + // abstract trait AttachableApi + // abstract trait FreeTermSymbolApi + // abstract trait FreeTypeSymbolApi + // abstract trait IdentContextApi + // abstract trait ReferenceToBoxedApi + // abstract trait SymTreeContextApi + // abstract trait SymbolContextApi + // abstract trait TreeContextApi + // abstract trait TypeTreeContextApi + locally(ClassDef(sym, impl): ClassDef) + locally(DefDef(sym, mods, vparamss, rhs): DefDef) + locally(DefDef(sym, vparamss, rhs): DefDef) + locally(DefDef(sym, mods, rhs): DefDef) + locally(DefDef(sym, rhs): DefDef) + locally(DefDef(sym, (??? : List[List[Symbol]] => Tree)): DefDef) + locally(LabelDef(sym, params, rhs): LabelDef) + locally(ModuleDef(sym, impl): ModuleDef) + locally(TypeDef(sym, rhs): TypeDef) + locally(TypeDef(sym): TypeDef) + locally(ValDef(sym, rhs): ValDef) + locally(ValDef(sym): ValDef) + locally(AnnotatedType(anns, tpe): AnnotatedType) + locally(BoundedWildcardType(??? : TypeBounds): BoundedWildcardType) + locally(TypeBounds(tpe, tpe): TypeBounds) + locally(MethodType(params, tpe): MethodType) + locally(RefinedType(tpes, decls): RefinedType) + locally(RefinedType(tpes, decls, sym): RefinedType) + locally(ClassInfoType(tpes, decls, sym): ClassInfoType) + locally(SingleType(tpe, sym): Type) + locally(TypeRef(tpe, sym, tpes): Type) + locally(ExistentialType(syms, tpe): ExistentialType) + locally(NullaryMethodType(tpe): NullaryMethodType) + locally(ThisType(sym): Type) + locally(SuperType(tpe, tpe): Type) + locally(PolyType(syms, tpe): PolyType) + locally(ConstantType(const): ConstantType) + locally(sym.asFreeTerm: FreeTermSymbol) + locally(sym.asFreeType: FreeTypeSymbol) + locally(existentialAbstraction(tparams, tpe): Type) + locally(tree.freeTerms: List[FreeTermSymbol]) + locally(tree.freeTypes: List[FreeTypeSymbol]) + locally(intersectionType(tpes): Type) + locally(intersectionType(tpes, sym): Type) + locally(sym.isErroneous: Boolean) + locally(sym.isFreeTerm: Boolean) + locally(sym.isFreeType: Boolean) + locally(sym.isLocal: Boolean) + locally(sym.isOverride: Boolean) + locally(tsym.isSkolem: Boolean) + locally(manifestToTypeTag(mirror, manifest): scala.reflect.api.Universe#TypeTag[Int]) + locally(mkImporter(scala.reflect.runtime.universe): Importer{val from: scala.reflect.runtime.universe.type}) + locally(sym.newClassSymbol(tyname, pos, flags): ClassSymbol) + locally(sym.newMethodSymbol(tename, pos, flags): MethodSymbol) + locally(sym.newModuleAndClassSymbol(name, pos, flags): (ModuleSymbol, ClassSymbol)) + locally(newScopeWith(sym, sym, sym): Scope) + locally(sym.newTermSymbol(tename, pos, flags): TermSymbol) + locally(sym.newTypeSymbol(tyname, pos, flags): TypeSymbol) + locally(polyType(tparams, tpe): Type) + locally(sym.pos: Position) + locally(refinedType(tpes, sym): Type) + locally(refinedType(tpes, sym, decls, pos): Type) + locally(singleType(tpe, sym): Type) + locally(tree.substituteSymbols(syms, syms): Tree) + locally(tree.substituteThis(sym, tree): Tree) + locally(tree.substituteTypes(syms, tpes): Tree) + locally(typeRef(tpe, sym, tpes): Type) + locally(typeTagToManifest(mirror, tag): Manifest[Int]) + locally(FreeTermSymbolTag: ClassTag[FreeTermSymbol]) + locally((??? : FreeTermSymbol).origin) + locally((??? : FreeTermSymbol).value) + locally(FreeTypeSymbolTag: ClassTag[FreeTypeSymbol]) + locally((??? : FreeTypeSymbol).origin) + locally(ReferenceToBoxedTag: ClassTag[ReferenceToBoxed]) + locally(build: BuildApi) + locally(ReferenceToBoxed(??? : Ident): ReferenceToBoxed) + locally((??? : ReferenceToBoxed).ident: Tree) + locally(ReferenceToBoxed.unapply(???): Option[Ident]) + locally(build.selectType(sym, str): TypeSymbol) + locally(build.selectTerm(sym, str): TermSymbol) + locally(build.selectOverloadedMethod(sym, str, i): MethodSymbol) + locally(build.newNestedSymbol(sym, name, pos, flags, b): Symbol) + locally(build.newFreeTerm(str, i): FreeTermSymbol) + locally(build.newFreeTerm(str, i, flags, str): FreeTermSymbol) + locally(build.newFreeType(str): FreeTypeSymbol) + locally(build.newFreeType(str, flags, str): FreeTypeSymbol) + locally(build.setTypeSignature(sym, tpe): Symbol) + locally(build.setAnnotations(sym, anns): Symbol) + locally(build.flagsFromBits(??? : Long): FlagSet) + locally(build.emptyValDef: ValDef) + locally(build.This(sym): Tree) + locally(build.Select(tree, sym): Select) + locally(build.Ident(sym): Ident) + locally(build.TypeTree(tpe): TypeTree) + locally(build.thisPrefix(sym): Type) + locally(build.setType(tree, tpe): Tree) + locally(build.setSymbol(tree, sym): Tree) +}
\ No newline at end of file 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 diff --git a/test/files/pos/t8300-conversions-a.scala b/test/files/pos/t8300-conversions-a.scala new file mode 100644 index 0000000000..248a8b73b2 --- /dev/null +++ b/test/files/pos/t8300-conversions-a.scala @@ -0,0 +1,23 @@ +// cf. pos/t8300-conversions-b.scala +trait Universe { + type Symbol >: Null <: AnyRef with SymbolApi + trait SymbolApi + + type TypeSymbol >: Null <: Symbol with TypeSymbolApi + trait TypeSymbolApi extends SymbolApi + + type FreeTypeSymbol >: Null <: TypeSymbol with FreeTypeSymbolApi + trait FreeTypeSymbolApi extends TypeSymbolApi + + implicit class CompatibleSymbol(sym: Symbol) { + def asFreeType: FreeTypeSymbol = ??? + } +} + +object Test extends App { + val u: Universe = ??? + import u._ + + val sym: Symbol = ??? + sym.asFreeType +}
\ No newline at end of file diff --git a/test/files/pos/t8300-conversions-b.scala b/test/files/pos/t8300-conversions-b.scala new file mode 100644 index 0000000000..0524ee3683 --- /dev/null +++ b/test/files/pos/t8300-conversions-b.scala @@ -0,0 +1,23 @@ +// cf. pos/t8300-conversions-a.scala +trait Universe { + type Symbol >: Null <: AnyRef with SymbolApi + trait SymbolApi + + type TypeSymbol >: Null <: TypeSymbolApi with Symbol + trait TypeSymbolApi extends SymbolApi + + type FreeTypeSymbol >: Null <: FreeTypeSymbolApi with TypeSymbol + trait FreeTypeSymbolApi extends TypeSymbolApi + + implicit class CompatibleSymbol(sym: Symbol) { + def asFreeType: FreeTypeSymbol = ??? + } +} + +object Test extends App { + val u: Universe = ??? + import u._ + + val sym: Symbol = ??? + sym.asFreeType +}
\ No newline at end of file diff --git a/test/files/pos/t8300-overloading.scala b/test/files/pos/t8300-overloading.scala new file mode 100644 index 0000000000..ae9699ab86 --- /dev/null +++ b/test/files/pos/t8300-overloading.scala @@ -0,0 +1,16 @@ +// cf. neg/t8300-overloading.scala +trait Universe { + type Name >: Null <: AnyRef with NameApi + trait NameApi + + type TermName >: Null <: TermNameApi with Name + trait TermNameApi extends NameApi +} + +object Test extends App { + val u: Universe = ??? + import u._ + + def foo(name: Name) = ??? + def foo(name: TermName) = ??? +}
\ No newline at end of file diff --git a/test/files/pos/t8300-patmat-a.scala b/test/files/pos/t8300-patmat-a.scala new file mode 100644 index 0000000000..4421c0a15e --- /dev/null +++ b/test/files/pos/t8300-patmat-a.scala @@ -0,0 +1,20 @@ +// cf. pos/t8300-patmat-b.scala +trait Universe { + type Name >: Null <: AnyRef with NameApi + trait NameApi + + type TermName >: Null <: Name with TermNameApi + trait TermNameApi extends NameApi +} + +object Test extends App { + val u: Universe = ??? + import u._ + + locally { + val ScalaName: TermName = ??? + ??? match { + case ScalaName => ??? + } + } +}
\ No newline at end of file diff --git a/test/files/pos/t8300-patmat-b.scala b/test/files/pos/t8300-patmat-b.scala new file mode 100644 index 0000000000..c01aeb912d --- /dev/null +++ b/test/files/pos/t8300-patmat-b.scala @@ -0,0 +1,20 @@ +// cf. pos/t8300-patmat-a.scala +trait Universe { + type Name >: Null <: AnyRef with NameApi + trait NameApi + + type TermName >: Null <: TermNameApi with Name + trait TermNameApi extends NameApi +} + +object Test extends App { + val u: Universe = ??? + import u._ + + locally { + val ScalaName: TermName = ??? + ??? match { + case ScalaName => ??? + } + } +}
\ No newline at end of file |