How to get the type of a tastyquery.ast.Trees.Tree
?
#32
-
There's a member protected def calculateType(): Type = throw new TypeComputationError(this) Is there currently a way to get the type of a |
Beta Was this translation helpful? Give feedback.
Answered by
bishabosha
Feb 16, 2022
Replies: 1 comment 1 reply
-
Hey, thank you for your question. Types still need to be implemented (as of February 2022). One exception is the type of a In SymbolSuite.scala, you could get the field of some class with this code: test("get-type-of-parameter") {
val ctx = getUnpicklingContext("simple_trees/ConstructorWithParameters")
val theValPath = SimpleName("simple_trees") :: TypeName(SimpleName("ConstructorWithParameters")) :: SimpleName("theVal") :: Nil
val theValSym = followPath(ctx.defn.RootPackage, theValPath)
val theValType = theValSym.tree.tpe
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
bishabosha
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, thank you for your question. Types still need to be implemented (as of February 2022).
One exception is the type of a
ValDef
tree, where thatValDef
comes from the parameter of a class.In SymbolSuite.scala, you could get the field of some class with this code: