We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d39b4aa + ae3d217 commit a4eb10aCopy full SHA for a4eb10a
compiler/src/dotty/tools/dotc/typer/Checking.scala
@@ -593,6 +593,8 @@ object Checking {
593
val mods = mdef.mods
594
def flagSourcePos(flag: FlagSet) =
595
mods.mods.find(_.flags == flag).getOrElse(mdef).srcPos
596
+ if mods.is(Open) then
597
+ report.error(ModifierNotAllowedForDefinition(Open), flagSourcePos(Open))
598
if mods.is(Abstract) then
599
report.error(ModifierNotAllowedForDefinition(Abstract), flagSourcePos(Abstract))
600
if mods.is(Sealed) then
tests/neg/i21760.scala
@@ -0,0 +1 @@
1
+open object O // error
0 commit comments