Created
July 31, 2015 12:30
-
-
Save xeno-by/13f107c26981e2a30ab2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 13:01 ~/Projects/scalahost/sandbox (master)$ s -Dconvert.debug | |
| ======= SCALA.REFLECT TREE ======= | |
| package test { | |
| class Bar extends scala.AnyRef { | |
| def <init>(): test.Bar = { | |
| Bar.super.<init>(); | |
| () | |
| } | |
| }; | |
| class Foo extends Bar { | |
| def <init>(): test.Foo = { | |
| Foo.super.<init>(); | |
| () | |
| }; | |
| def bar(a: Int): Int = a | |
| } | |
| } | |
| PackageDef[1](Ident[2](test#7833), List(ClassDef[1](Modifiers(), test.Bar#7835, List(), Template[3](List(Select[4](Ident[5](scala#24), TypeName("AnyRef")#2775)), noSelfType, List(DefDef[1](Modifiers(), termNames.CONSTRUCTOR#7923, List(), List(List()), TypeTree[3](), Block[6](List(Apply[7](Select[8](Super[9](This[3](TypeName("Bar")), typeNames.EMPTY), termNames.CONSTRUCTOR#3125), List())), Literal[6](Constant(()))))))), ClassDef[1](Modifiers(), test.Foo#7836, List(), Template[10](List(Ident[3](test.Bar#7835)), noSelfType, List(DefDef[1](Modifiers(), termNames.CONSTRUCTOR#15959, List(), List(List()), TypeTree[10](), Block[6](List(Apply[3](Select[11](Super[12](This[10](TypeName("Foo")), typeNames.EMPTY), termNames.CONSTRUCTOR#7923), List())), Literal[6](Constant(())))), DefDef[1](Modifiers(), TermName("bar")#15960, List(), List(List(ValDef[1](Modifiers(PARAM), TermName("a")#15962, TypeTree[13]().setOriginal(Select[13](Ident[5](scala#24), scala.Int#1854)), EmptyTree))), TypeTree[13](), Ident[13](TermName("a")#15962))))))) | |
| [1] NoType | |
| [2] SingleType(ThisType(<root>#2), test#7833) | |
| [3] TypeRef(ThisType(test#7834), test.Bar#7835, List()) | |
| [4] TypeRef(ThisType(scala#25), TypeName("AnyRef")#2775, List()) | |
| [5] SingleType(ThisType(<root>#2), scala#24) | |
| [6] TypeRef(ThisType(scala#25), scala.Unit#2733, List()) | |
| [7] TypeRef(ThisType(java.lang#31), java.lang.Object#128, List()) | |
| [8] MethodType(List(), TypeRef(ThisType(java.lang#31), java.lang.Object#128, List())) | |
| [9] SuperType(ThisType(test.Bar#7835), TypeRef(ThisType(scala#25), TypeName("AnyRef")#2775, List())) | |
| [10] TypeRef(ThisType(test#7834), test.Foo#7836, List()) | |
| [11] MethodType(List(), TypeRef(ThisType(test#7834), test.Bar#7835, List())) | |
| [12] SuperType(ThisType(test.Foo#7836), TypeRef(ThisType(test#7834), test.Bar#7835, List())) | |
| [13] TypeRef(ThisType(scala#25), scala.Int#1854, List()) | |
| ======== SCALA.META TREE ======== | |
| package test | |
| class Bar() extends scala.AnyRef() {} | |
| class Foo() extends Bar() { def bar(a: Int): Int = a } | |
| Source(List(Pkg(Term.Name("test")[1]{1}, List(Defn.Class(Nil, Type.Name("Bar")[2], Nil, Ctor.Primary(Nil, Ctor.Ref.Name("Bar")[3]{2}, List(Nil)), Template(Nil, List(Term.Apply(Ctor.Ref.Select(Term.Name("scala")[4]{3}, Ctor.Ref.Name("AnyRef")[5]{4}), Nil)), Term.Param(Nil, Name.Anonymous(), None, None), Some(Nil))), Defn.Class(Nil, Type.Name("Foo")[6], Nil, Ctor.Primary(Nil, Ctor.Ref.Name("Foo")[7]{5}, List(Nil)), Template(Nil, List(Term.Apply(Ctor.Ref.Name("Bar")[3]{2}, Nil)), Term.Param(Nil, Name.Anonymous(), None, None), Some(List(Defn.Def(Nil, Term.Name("bar")[8], Nil, List(List(Term.Param(Nil, Term.Name("a")[9], Some(Type.Name("Int")[10]), None))), Some(Type.Name("Int")[10]), Term.Name("a")[9]{6}))))))))) | |
| [1] Type.Singleton(Term.Name("_root_")[11]{7})::test | |
| [2] Type.Singleton(Term.Name("test")[1]{1})::test#Bar | |
| [3] Type.Singleton(Term.Name("test")[1]{1})::test#Bar.<init>()V | |
| [4] Type.Singleton(Term.Name("_root_")[11]{7})::scala | |
| [5] Type.Singleton(Term.Name("lang")[12]{8})::java.lang#Object.<init>()V | |
| [6] Type.Singleton(Term.Name("test")[1]{1})::test#Foo | |
| [7] Type.Singleton(Term.Name("test")[1]{1})::test#Foo.<init>()V | |
| [8] Type.Singleton(Term.This(Name.Indeterminate("Foo")[6]){9})::test#Foo.bar(I)I | |
| [9] 0::test#Foo.bar(I)I.a | |
| [10] Type.Singleton(Term.Name("scala")[4]{3})::scala#Int | |
| [11] 0::_root_ | |
| [12] Type.Singleton(Term.Name("java")[14]{10})::java.lang | |
| [13] Type.Singleton(Term.Name("lang")[12]{8})::java.lang#Object | |
| [14] Type.Singleton(Term.Name("_root_")[11]{7})::java | |
| {1} Type.Singleton(Term.Name("test")[1]{1}) | |
| {2} Type.Name("Bar")[2] | |
| {3} Type.Singleton(Term.Name("scala")[4]{3}) | |
| {4} Type.Name("Object")[13] | |
| {5} Type.Name("Foo")[6] | |
| {6} Type.Name("Int")[10] | |
| {7} Type.Singleton(Term.Name("_root_")[11]{7}) | |
| {8} Type.Singleton(Term.Name("lang")[12]{8}) | |
| {9} Type.Singleton(Term.This(Name.Indeterminate("Foo")[6]){9}) | |
| {10} Type.Singleton(Term.Name("java")[14]{10}) | |
| ================================= | |
| error: org.scalameta.UnreachableError: this code path should've been unreachable | |
| where meta.this.`package`.XtensionShow[scala.meta.internal.ast.Tree](semanticTree).show[scala.meta.Structure](ui.this.Structure.structureTree[scala.meta.internal.ast.Tree]) = Source(List(Pkg(Term.Name("test"), List(Defn.Class(Nil, Type.Name("Bar"), Nil, Ctor.Primary(Nil, Ctor.Ref.Name("Bar"), List(Nil)), Template(Nil, List(Term.Apply(Ctor.Ref.Select(Term.Name("scala"), Ctor.Ref.Name("AnyRef")), Nil)), Term.Param(Nil, Name.Anonymous(), None, None), Some(Nil))), Defn.Class(Nil, Type.Name("Foo"), Nil, Ctor.Primary(Nil, Ctor.Ref.Name("Foo"), List(Nil)), Template(Nil, List(Term.Apply(Ctor.Ref.Name("Bar"), Nil)), Term.Param(Nil, Name.Anonymous(), None, None), Some(List(Defn.Def(Nil, Term.Name("bar"), Nil, List(List(Term.Param(Nil, Term.Name("a"), Some(Type.Name("Int")), None))), Some(Type.Name("Int")), Term.Name("a")))))))))) | |
| where meta.this.`package`.XtensionShow[scala.meta.internal.ast.Tree](syntacticTree).show[scala.meta.Structure](ui.this.Structure.structureTree[scala.meta.internal.ast.Tree]) = Source(List(Pkg(Term.Name("test"), List(Defn.Class(Nil, Type.Name("Bar"), Nil, Ctor.Primary(Nil, Ctor.Ref.Name("this"), Nil), Template(Nil, Nil, Term.Param(Nil, Name.Anonymous(), None, None), None)), Defn.Class(Nil, Type.Name("Foo"), Nil, Ctor.Primary(Nil, Ctor.Ref.Name("this"), Nil), Template(Nil, List(Ctor.Ref.Name("Bar")), Term.Param(Nil, Name.Anonymous(), None, None), Some(List(Defn.Def(Nil, Term.Name("bar"), Nil, List(List(Term.Param(Nil, Term.Name("a"), Some(Type.Name("Int")), None))), None, Term.Name("a")))))))))) | |
| where semanticTree = package test | |
| class Bar() extends scala.AnyRef() {} | |
| class Foo() extends Bar() { def bar(a: Int): Int = a } | |
| where syntacticTree = package test | |
| /** scaladoc for bar */ | |
| class Bar | |
| /** | |
| * Scaladoc for Foo class | |
| */ | |
| class Foo extends Bar { | |
| def bar(a: Int) = a | |
| } | |
| at org.scalameta.UnreachableError$.raise(package.scala:18) | |
| at scala.meta.internal.hosts.scalac.converters.mergeTrees$.apply(MergeTrees.scala:13) | |
| at scala.meta.internal.hosts.scalac.ConvertPhase$ConvertComponent$$anon$1.apply(ConvertPhase.scala:40) | |
| at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:440) | |
| at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:431) | |
| at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:440) | |
| at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:398) | |
| at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:398) | |
| at scala.collection.Iterator$class.foreach(Iterator.scala:742) | |
| at scala.collection.AbstractIterator.foreach(Iterator.scala:1194) | |
| at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:398) | |
| at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1501) | |
| at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1486) | |
| at scala.tools.nsc.Global$Run.compileSources(Global.scala:1481) | |
| at scala.tools.nsc.Global$Run.compile(Global.scala:1582) | |
| at scala.tools.nsc.Driver.doCompile(Driver.scala:32) | |
| at scala.tools.nsc.MainClass.doCompile(Main.scala:23) | |
| at scala.tools.nsc.Driver.process(Driver.scala:51) | |
| at scala.tools.nsc.Driver.main(Driver.scala:64) | |
| at scala.tools.nsc.Main.main(Main.scala) | |
| Exception in thread "main" org.scalameta.UnreachableError: this code path should've been unreachable | |
| where meta.this.`package`.XtensionShow[scala.meta.internal.ast.Tree](semanticTree).show[scala.meta.Structure](ui.this.Structure.structureTree[scala.meta.internal.ast.Tree]) = Source(List(Pkg(Term.Name("test"), List(Defn.Class(Nil, Type.Name("Bar"), Nil, Ctor.Primary(Nil, Ctor.Ref.Name("Bar"), List(Nil)), Template(Nil, List(Term.Apply(Ctor.Ref.Select(Term.Name("scala"), Ctor.Ref.Name("AnyRef")), Nil)), Term.Param(Nil, Name.Anonymous(), None, None), Some(Nil))), Defn.Class(Nil, Type.Name("Foo"), Nil, Ctor.Primary(Nil, Ctor.Ref.Name("Foo"), List(Nil)), Template(Nil, List(Term.Apply(Ctor.Ref.Name("Bar"), Nil)), Term.Param(Nil, Name.Anonymous(), None, None), Some(List(Defn.Def(Nil, Term.Name("bar"), Nil, List(List(Term.Param(Nil, Term.Name("a"), Some(Type.Name("Int")), None))), Some(Type.Name("Int")), Term.Name("a")))))))))) | |
| where meta.this.`package`.XtensionShow[scala.meta.internal.ast.Tree](syntacticTree).show[scala.meta.Structure](ui.this.Structure.structureTree[scala.meta.internal.ast.Tree]) = Source(List(Pkg(Term.Name("test"), List(Defn.Class(Nil, Type.Name("Bar"), Nil, Ctor.Primary(Nil, Ctor.Ref.Name("this"), Nil), Template(Nil, Nil, Term.Param(Nil, Name.Anonymous(), None, None), None)), Defn.Class(Nil, Type.Name("Foo"), Nil, Ctor.Primary(Nil, Ctor.Ref.Name("this"), Nil), Template(Nil, List(Ctor.Ref.Name("Bar")), Term.Param(Nil, Name.Anonymous(), None, None), Some(List(Defn.Def(Nil, Term.Name("bar"), Nil, List(List(Term.Param(Nil, Term.Name("a"), Some(Type.Name("Int")), None))), None, Term.Name("a")))))))))) | |
| where semanticTree = package test | |
| class Bar() extends scala.AnyRef() {} | |
| class Foo() extends Bar() { def bar(a: Int): Int = a } | |
| where syntacticTree = package test | |
| /** scaladoc for bar */ | |
| class Bar | |
| /** | |
| * Scaladoc for Foo class | |
| */ | |
| class Foo extends Bar { | |
| def bar(a: Int) = a | |
| } | |
| at org.scalameta.UnreachableError$.raise(package.scala:18) | |
| at scala.meta.internal.hosts.scalac.converters.mergeTrees$.apply(MergeTrees.scala:13) | |
| at scala.meta.internal.hosts.scalac.ConvertPhase$ConvertComponent$$anon$1.apply(ConvertPhase.scala:40) | |
| at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:440) | |
| at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:431) | |
| at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:440) | |
| at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:398) | |
| at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:398) | |
| at scala.collection.Iterator$class.foreach(Iterator.scala:742) | |
| at scala.collection.AbstractIterator.foreach(Iterator.scala:1194) | |
| at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:398) | |
| at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1501) | |
| at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1486) | |
| at scala.tools.nsc.Global$Run.compileSources(Global.scala:1481) | |
| at scala.tools.nsc.Global$Run.compile(Global.scala:1582) | |
| at scala.tools.nsc.Driver.doCompile(Driver.scala:32) | |
| at scala.tools.nsc.MainClass.doCompile(Main.scala:23) | |
| at scala.tools.nsc.Driver.process(Driver.scala:51) | |
| at scala.tools.nsc.Driver.main(Driver.scala:64) | |
| at scala.tools.nsc.Main.main(Main.scala) | |
| 13:04 ~/Projects/scalahost/sandbox (master)$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment