Skip to content

Commit a163c3f

Browse files
authored
Merge pull request #15548 from KacperFKorban/fix-i9314
Try to avoid static symbols if leaving them would make a leak
2 parents 99d0802 + bc207ad commit a163c3f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ object TypeOps:
511511
@threadUnsafe lazy val forbidden = symsToAvoid.toSet
512512
def toAvoid(tp: NamedType) =
513513
val sym = tp.symbol
514-
!sym.isStatic && forbidden.contains(sym)
514+
forbidden.contains(sym)
515515

516516
override def apply(tp: Type): Type = tp match
517517
case tp: TypeVar if mapCtx.typerState.constraint.contains(tp) =>

tests/pos/i9314.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
final class fooAnnot[T](member: T) extends scala.annotation.StaticAnnotation // must have type parameter
2+
3+
@fooAnnot(new RecAnnotated {}) // must pass instance of anonymous subclass
4+
trait RecAnnotated

0 commit comments

Comments
 (0)