Skip to content

Instantly share code, notes, and snippets.

@mrdziuban
Created February 23, 2024 17:21
Show Gist options
  • Save mrdziuban/7788124c751418045bce21436d9cf409 to your computer and use it in GitHub Desktop.
Save mrdziuban/7788124c751418045bce21436d9cf409 to your computer and use it in GitHub Desktop.
enum-trees.txt
********************************************************************************
tpe.typeSymbol: TypeDef(
Foo,
Template(
DefDef(
<init>,
List(
List(
ValDef(
x,
Ident(
Int
),
EmptyTree
)
)
),
TypeTree[TypeRef(
ThisType(
TypeRef(
NoPrefix,
module class scala
)
),
class Unit
)],
EmptyTree
),
List(
Apply(
Select(
New(
TypeTree[TypeRef(
ThisType(
TypeRef(
NoPrefix,
module class lang
)
),
class Object
)]
),
<init>
),
List()
),
TypeTree[TypeRef(
ThisType(
TypeRef(
NoPrefix,
module class reflect
)
),
trait Enum
)]
),
ValDef(
_,
EmptyTree,
EmptyTree
),
List(
ValDef(
x,
TypeTree[TypeRef(
TermRef(
ThisType(
TypeRef(
NoPrefix,
module class <root>
)
),
object scala
),
class Int
)],
EmptyTree
),
Import(
Ident(
Foo
),
List(
ImportSelector(
Ident(
Bar
),
EmptyTree,
EmptyTree
)
)
)
)
)
)
********************************************************************************
tpe.termSymbol: ValDef(
Bar,
TypeTree[TypeRef(
ThisType(
TypeRef(
NoPrefix,
module class example
)
),
class Foo
)],
Block(
List(
TypeDef(
$anon,
Template(
DefDef(
<init>,
List(
List()
),
TypeTree[TypeRef(
ThisType(
TypeRef(
NoPrefix,
module class scala
)
),
class Unit
)],
EmptyTree
),
List(
Apply(
Select(
New(
Ident(
Foo
)
),
<init>
),
List(
Literal(
Constant(
1
)
)
)
),
Select(
Select(
Select(
Ident(
_root_
),
scala
),
runtime
),
EnumValue
),
TypeTree[TypeRef(
ThisType(
TypeRef(
ThisType(
TypeRef(
NoPrefix,
module class deriving
)
),
module class Mirror$
)
),
trait Singleton
)]
),
ValDef(
_,
EmptyTree,
EmptyTree
),
List(
DefDef(
readResolve,
List(
List()
),
TypeTree[TypeRef(
ThisType(
TypeRef(
NoPrefix,
module class scala
)
),
type AnyRef
)],
Apply(
Select(
Ident(
Foo
),
fromOrdinal
),
List(
Select(
This(
Ident(
$anon
)
),
ordinal
)
)
)
),
DefDef(
productPrefix,
List(),
TypeTree[TypeRef(
TermRef(
ThisType(
TypeRef(
NoPrefix,
module class scala
)
),
object Predef
),
type String
)],
Literal(
Constant(
Bar
)
)
),
DefDef(
toString,
List(
List()
),
TypeTree[TypeRef(
ThisType(
TypeRef(
NoPrefix,
module class lang
)
),
class String
)],
Literal(
Constant(
Bar
)
)
),
DefDef(
ordinal,
List(),
TypeTree[TypeRef(
TermRef(
ThisType(
TypeRef(
NoPrefix,
module class <root>
)
),
object scala
),
Int
)],
Literal(
Constant(
0
)
)
)
)
)
)
),
Typed(
Apply(
Select(
New(
Ident(
$anon
)
),
<init>
),
List()
),
TypeTree[AndType(
TypeRef(
ThisType(
TypeRef(
NoPrefix,
module class example
)
),
class Foo
),
TypeRef(
TermRef(
TermRef(
TermRef(
NoPrefix,
object _root_
),
object scala
),
object runtime
),
trait EnumValue
)
)]
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment