Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Annotation.refersToParamOf to work with parameter references outside of Ident or This #22008

Open
2 tasks
mbovel opened this issue Nov 22, 2024 · 0 comments
Open
2 tasks

Comments

@mbovel
Copy link
Member

mbovel commented Nov 22, 2024

Currently, Annotations.refersToParamOf assumes that all TermParamRef types will only appear as the (root) type of Ident or This trees:

def refersToParamOf(tl: TermLambda)(using Context): Boolean =
val args = arguments
if args.isEmpty then false
else tree.existsSubTree:
case id: (Ident | This) => id.tpe.stripped match
case TermParamRef(tl1, _) => tl eq tl1
case _ => false
case _ => false

This assumption can be invalidated, for example when trees are generated by macros.

See #22001 (comment) for prior discussion. I proposed two fixes there.

To do:

  • write test-cases,
  • find the minimal fix: refersToParamOf should visit the least possible number of trees and types.
@mbovel mbovel added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label area:annotations and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 22, 2024
@mbovel mbovel self-assigned this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant