Skip to content

Commit 74cfaea

Browse files
committed
Disregard synthetic definitions from experimental imports checks
1 parent 542d525 commit 74cfaea

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ object Checking {
729729
def checkExperimentalImports(trees: List[Tree])(using Context): Unit =
730730
def onlyExperimentalDefs = trees.forall {
731731
case _: Import | EmptyTree => true
732-
case stat: MemberDef => stat.symbol.isExperimental
732+
case stat: MemberDef => stat.symbol.isExperimental || stat.symbol.is(Synthetic)
733733
case _ => false
734734
}
735735
for case imp @ Import(qual, selectors) <- trees do

tests/pos/experimental-erased.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,14 @@ import language.experimental.erasedDefinitions
22
import annotation.experimental
33

44
@experimental
5-
erased class CanThrow[-E <: Exception]
5+
erased class CanThrow[-E <: Exception](val i: Int = 0)
6+
7+
@experimental
8+
object Foo
9+
10+
@experimental
11+
def bar = 1
12+
13+
14+
615

0 commit comments

Comments
 (0)