Edit this page on GitHub

Dropped: Class Shadowing - More Details

Spec diff: in section 5.1.4 Overriding, add M' must not be a class.

Why do we want to make this change to the language?

Class shadowing is irregular compared to other types of overrides. Indeed, inner classes are not actually overridden but simply shadowed.

How much existing code is going to be affected?

From all the code compiled so far with Scala 3 the only instance of this I could find is in the stdlib. Looking at this commit it seems like the usage of class shadowing was accidental.

How exactly is existing code going to be affected?

Code that relies on overridden inner classes will stop compiling.

Is this change going to be migratable automatically?

No.