Skip to content

Commit 5a363f1

Browse files
Improve conditions
1 parent 2c32951 commit 5a363f1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ trait Checking {
680680
case tp: ConstantType if exprPurity(tree) >= purityLevel => // ok
681681
case tp =>
682682
def isCaseClassApply(sym: Symbol): Boolean =
683-
sym.name == nme.apply && sym.owner.is(Module) && sym.owner.companionClass.is(Case)
683+
sym.name == nme.apply && sym.is(Synthetic) && sym.owner.is(Module) && sym.owner.companionClass.is(Case)
684684
def isCaseClassNew(sym: Symbol): Boolean =
685685
sym.isPrimaryConstructor && sym.owner.is(Case) && sym.owner.isStatic
686686
def isCaseObject(sym: Symbol): Boolean = {
@@ -691,7 +691,7 @@ trait Checking {
691691
ctx.erasedTypes ||
692692
ctx.inInlineMethod ||
693693
(tree.symbol.isStatic && isCaseObject(tree.symbol) || isCaseClassApply(tree.symbol)) ||
694-
(tree.symbol.owner.isStatic && isCaseClassNew(tree.symbol))
694+
isCaseClassNew(tree.symbol)
695695
if (!allow) ctx.error(em"$what must be a known value", tree.pos)
696696
else {
697697
def checkArgs(tree: Tree): Unit = tree match {

0 commit comments

Comments
 (0)