Skip to content

Commit daef5f4

Browse files
Fix #8391: Track locally defined @Alpha aliases only for definitions
1 parent 63343d2 commit daef5f4

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ trait Checking {
11291129
val preExisting = ctx.effectiveScope.lookup(ename)
11301130
if (preExisting.exists || seen.contains(ename))
11311131
ctx.error(em"@alpha annotation ${'"'}$ename${'"'} clashes with other definition is same scope", stat.sourcePos)
1132-
seen += ename
1132+
if stat.isDef then seen += ename
11331133
}
11341134
}
11351135
}

tests/pos/i8391.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import scala.annotation.alpha
2+
3+
trait Foo {
4+
@alpha("intersection")
5+
def *(other: Foo): Foo
6+
}
7+
8+
@main def Test() = {
9+
val s: Foo = ???
10+
s * s
11+
s * s
12+
s * s
13+
}

0 commit comments

Comments
 (0)