-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow inner classes of universal traits #18796
Allow inner classes of universal traits #18796
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
@@ -2785,11 +2785,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer | |||
checkDerivedValueClass(cls, body1) | |||
|
|||
val effectiveOwner = cls.owner.skipWeakOwner | |||
if !cls.isRefinementClass | |||
&& !cls.isAllOf(PrivateLocal) | |||
if cls.is(ModuleClass) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not have any neg
tests for this case. The following seems to cover what we are missing.
trait Outer extends Any {
trait Inner1
trait Inner2 extends Any
class Inner3
class Inner4(a: Int) extends AnyVal // error
case class Inner5(a: Int) // error
object Inner6 // error
}
@nicolasstucki Can you please add the test? I am already deep in something else. |
I will add the tests |
Just forbid inner objects. This aligns with Scala 2 and allows us to keep Seq's definition as in Scala 2.
9fa6e04
to
0758156
Compare
Just forbid inner objects. This aligns with Scala 2 and allows us to keep Seq's definition as in Scala 2 when porting or capture checking the standard library.