Skip to content

Commit

Permalink
Check This references in refersToParamOf
Browse files Browse the repository at this point in the history
  • Loading branch information
Linyxus committed Mar 23, 2024
1 parent a36849f commit 10468e5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler/src/dotty/tools/dotc/core/Annotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,11 @@ object Annotations {
def refersToParamOf(tl: TermLambda)(using Context): Boolean =
val args = arguments
if args.isEmpty then false
else tree.existsSubTree {
case id: Ident => id.tpe.stripped match
else tree.existsSubTree:
case id: (Ident | This) => id.tpe.stripped match
case TermParamRef(tl1, _) => tl eq tl1
case _ => false
case _ => false
}

/** A string representation of the annotation. Overridden in BodyAnnotation.
*/
Expand Down
13 changes: 13 additions & 0 deletions tests/pos-custom-args/captures/i19990.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import language.experimental.captureChecking

trait Iterable[T] { self: Iterable[T]^ =>
def map[U](f: T => U): Iterable[U]^{this, f}
}

object Test {
def indentLines(level: Int, lines: Iterable[String]) =
lines.map(line => line.split("\n").map(" " + _).mkString("\n"))

def indentErrorMessages(messages: Iterable[String]) =
indentLines(1, messages)
}

0 comments on commit 10468e5

Please sign in to comment.