Skip to content

Commit e07da93

Browse files
committed
Avoid closure creation in hot assert
1 parent 4811889 commit e07da93

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/core/Flags.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ object Flags {
2222
else if (that.bits == 0) this
2323
else {
2424
val tbits = bits & that.bits & KINDFLAGS
25-
assert(tbits != 0, s"illegal flagset combination: $this and $that")
25+
if (tbits == 0) // Optimised to not create the closure
26+
assert(false, s"illegal flagset combination: $this and $that")
2627
FlagSet(tbits | ((this.bits | that.bits) & ~KINDFLAGS))
2728
}
2829

0 commit comments

Comments
 (0)