Skip to content

Commit 44cb5fd

Browse files
committed
Use correct context for checking annotations
Without this change, for the following code: class foo(x: Any) extends annotation.StaticAnnotation @foo({ val x = 3; x}) class A The compiler incorrectly enters `x` as a member of class `A`.
1 parent a664f52 commit 44cb5fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ class Namer { typer: Typer =>
859859
if (cls eq sym)
860860
ctx.error("An annotation class cannot be annotated with iself", annotTree.sourcePos)
861861
else {
862-
val ann = Annotation.deferred(cls)(typedAnnotation(annotTree))
862+
val ann = Annotation.deferred(cls)(typedAnnotation(annotTree)(using annotCtx))(using annotCtx)
863863
sym.addAnnotation(ann)
864864
}
865865
}

0 commit comments

Comments
 (0)