File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -653,15 +653,6 @@ object desugar {
653
653
val mods = mdef.mods
654
654
def isEnumCase = mods.isEnumCase
655
655
656
- def flagPos (flag : FlagSet ) = mods.mods.find(_.flags == flag).get.pos
657
-
658
- if (mods is Abstract )
659
- ctx.error(hl """ ${" abstract" } modifier cannot be used for objects """ , flagPos(Abstract ))
660
- for (flag <- List (Sealed , Final )) {
661
- if (mods is flag)
662
- ctx.warning(hl """ $flag modifier is redundant for objects """ , flagPos(flag))
663
- }
664
-
665
656
if (mods is Package )
666
657
PackageDef (Ident (moduleName), cpy.ModuleDef (mdef)(nme.PACKAGE , impl).withMods(mods &~ Package ) :: Nil )
667
658
else if (isEnumCase)
Original file line number Diff line number Diff line change @@ -2316,6 +2316,15 @@ object Parsers {
2316
2316
2317
2317
def objectDefRest (start : Offset , mods : Modifiers , name : TermName ): ModuleDef = {
2318
2318
val template = templateOpt(emptyConstructor)
2319
+
2320
+ def flagPos (flag : FlagSet ) = mods.mods.find(_.flags == flag).get.pos
2321
+ if (mods is Abstract )
2322
+ syntaxError(hl """ ${" abstract" } modifier cannot be used for objects """ , flagPos(Abstract ))
2323
+ for (flag <- List (Sealed , Final )) {
2324
+ if (mods is flag)
2325
+ warning(hl """ $flag modifier is redundant for objects """ , source atPos flagPos(flag))
2326
+ }
2327
+
2319
2328
ModuleDef (name, template).withMods(mods).setComment(in.getDocComment(start))
2320
2329
}
2321
2330
You can’t perform that action at this time.
0 commit comments