Skip to content

Commit 53aa32a

Browse files
authored
Check This references in refersToParamOf (#20005)
fixes #19990 See the [comment](#19990 (comment)) of that issue for an explanation of this issue.
2 parents a36849f + 10468e5 commit 53aa32a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

compiler/src/dotty/tools/dotc/core/Annotations.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,11 @@ object Annotations {
7272
def refersToParamOf(tl: TermLambda)(using Context): Boolean =
7373
val args = arguments
7474
if args.isEmpty then false
75-
else tree.existsSubTree {
76-
case id: Ident => id.tpe.stripped match
75+
else tree.existsSubTree:
76+
case id: (Ident | This) => id.tpe.stripped match
7777
case TermParamRef(tl1, _) => tl eq tl1
7878
case _ => false
7979
case _ => false
80-
}
8180

8281
/** A string representation of the annotation. Overridden in BodyAnnotation.
8382
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import language.experimental.captureChecking
2+
3+
trait Iterable[T] { self: Iterable[T]^ =>
4+
def map[U](f: T => U): Iterable[U]^{this, f}
5+
}
6+
7+
object Test {
8+
def indentLines(level: Int, lines: Iterable[String]) =
9+
lines.map(line => line.split("\n").map(" " + _).mkString("\n"))
10+
11+
def indentErrorMessages(messages: Iterable[String]) =
12+
indentLines(1, messages)
13+
}

0 commit comments

Comments
 (0)