Skip to content

Conversation

nicolasstucki
Copy link
Contributor

The symbols of trees do not have enough information to determine the full dependencies. For example, if we have an Ident we need to look at its type to figure out which is the this prefix on which it is defined.

Fix #18434

@nicolasstucki nicolasstucki marked this pull request as ready for review August 24, 2023 18:59
@nicolasstucki nicolasstucki requested a review from smarter August 24, 2023 18:59
* This corresponds to the symbols that will need to be interpreted.
*/
private def macroDependencies(tree: Tree)(using Context) =
val typeAccumulator = new TypeAccumulator[List[Symbol]] {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to figure out if this is good enough because it's hard to know which trees are valid here. I think it'd be much clearer if we combined this logic and the checks from checkIfValidStaticCall in the same traversal, so we'd know exactly which tree shape we need to handle.

By the way, checkIfValidStaticCall is flawed because of local imports:

object Inline extends Macro { val x: Macro = ??? import x._ inline def callMacro(): Int = ${ impl() } }
@smarter smarter assigned nicolasstucki and unassigned smarter Aug 24, 2023
The symbols of trees do not have enough information to determine the full dependencies. For example, if we have an `Ident` we need to look at its type to figure out which is the `this` prefix on which it is defined. Fix scala#18434
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants