File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -1811,8 +1811,11 @@ class Typer extends Namer
1811
1811
checkDerivedValueClass(cls, body1)
1812
1812
1813
1813
val effectiveOwner = cls.owner.skipWeakOwner
1814
- if cls.is(CaseClass ) && effectiveOwner.is(Trait ) && ! effectiveOwner.derivesFrom(defn.ObjectClass )
1815
- ctx.error(i " case $cls cannot be defined in universal $effectiveOwner" , cdef.sourcePos)
1814
+ if ! cls.isRefinementClass
1815
+ && ! cls.isAllOf(PrivateLocal )
1816
+ && effectiveOwner.is(Trait )
1817
+ && ! effectiveOwner.derivesFrom(defn.ObjectClass )
1818
+ ctx.error(i " $cls cannot be defined in universal $effectiveOwner" , cdef.sourcePos)
1816
1819
1817
1820
// Temporarily set the typed class def as root tree so that we have at least some
1818
1821
// information in the IDE in case we never reach `SetRootTree`.
You can’t perform that action at this time.
0 commit comments