Skip to content

Commit

Permalink
Merge pull request #14857 from dotty-staging/fix-5037
Browse files Browse the repository at this point in the history
Tweak assertion in withMods
  • Loading branch information
anatoliykmetyuk authored Apr 7, 2022
2 parents edc94c0 + c192ce4 commit 31f871c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compiler/src/dotty/tools/dotc/ast/untpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,10 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
else {
if (ms.nonEmpty)
for (m <- ms)
assert(flags.isAllOf(m.flags) ||
m.isInstanceOf[Mod.Private] && !privateWithin.isEmpty,
s"unaccounted modifier: $m in $this when adding $ms")
assert(flags.isAllOf(m.flags)
|| m.isInstanceOf[Mod.Private] && !privateWithin.isEmpty
|| (m.isInstanceOf[Mod.Abstract] || m.isInstanceOf[Mod.Override]) && flags.is(AbsOverride),
s"unaccounted modifier: $m in $this with flags ${flags.flagsString} when adding $ms")
copy(mods = ms)
}

Expand Down
3 changes: 3 additions & 0 deletions tests/neg/i5037.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Foo {
abstract override var // error
}

0 comments on commit 31f871c

Please sign in to comment.