-
Notifications
You must be signed in to change notification settings - Fork 1.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
Handle super accessors in initialization checker #15703
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.
def foo(): Int = m | ||
|
||
class N extends A with B: | ||
override def foo(): Int = 10 * super.foo() |
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.
Should this test have an additional field to ensure that this def foo
is not considered to be called during initialization (like the n
field in the other test)?
@@ -1175,9 +1179,8 @@ object Semantic: | |||
// Note that a parameterized trait may only get parameters from the class that extends the trait. | |||
// A trait may not supply constructor arguments to another trait. | |||
if !klass.is(Flags.Trait) then | |||
for parent <- klass.parentSyms if parent.hasSource do doPromote(parent.asClass, klass, isHotSegment) |
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.
Why is it OK to remove this? We don't need to promote super-trait segments? Is it because it is duplicated by the promotion of mixins below?
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.
Yes, with the changes we avoid some duplicate check (with cache they are not expensive though):
trait A
class B extends A
class C extends B with A
Handle super accessors in initialization checker