Skip to content

Commit

Permalink
Consider all arguments in Annotations.refersToParamOf (scala#22001)
Browse files Browse the repository at this point in the history
We should also include type arguments in `Annotations.refersToParamOf`.
  • Loading branch information
mbovel authored Nov 22, 2024
2 parents 912b6f2 + 63dc305 commit 7ba88ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Annotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ object Annotations {

/** Does this annotation refer to a parameter of `tl`? */
def refersToParamOf(tl: TermLambda)(using Context): Boolean =
val args = arguments
val args = tpd.allArguments(tree)
if args.isEmpty then false
else tree.existsSubTree:
case id: (Ident | This) => id.tpe.stripped match
Expand Down
5 changes: 5 additions & 0 deletions tests/pos/dependent-annot-type-param.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class annot[T] extends annotation.Annotation
class Box[T]()
def f(x: Int): Int @annot[Box[x.type]] = x
def test =
val foo = f(42)

0 comments on commit 7ba88ad

Please sign in to comment.