Skip to content

Fix #1392: Disallow super-calls that cannot be implemented correctly #6407

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

Merged
merged 1 commit into from
May 1, 2019

Conversation

smarter
Copy link
Member

@smarter smarter commented Apr 30, 2019

A call super[T].m that resolves to A.m cannot be translated to
correct bytecode if A is a class (not a trait / interface), but not
the direct superclass. Invokespecial would select an overriding method
in the direct superclass, rather than A.m. We allow this if there are
statically no intervening overrides.

Based on
scala/scala@a980fde
and
scala/scala@0a84038

Note that unlike Scala 2 we do not need to check if the mixin part of a
Super is to a direct parent here because this is already done in
TypeAssigner.

Co-Authored-By: Jason Zaugg [email protected]
Co-Authored-By: Lukas Rytz [email protected]

@smarter smarter force-pushed the fix-super-intermediate branch from 315a670 to 73e33b1 Compare April 30, 2019 16:44
@smarter smarter requested a review from odersky April 30, 2019 17:40
…ctly

A call `super[T].m` that resolves to `A.m` cannot be translated to
correct bytecode if `A` is a class (not a trait / interface), but not
the direct superclass. Invokespecial would select an overriding method
in the direct superclass, rather than `A.m`. We allow this if there are
statically no intervening overrides.

Based on
scala/scala@a980fde
and
scala/scala@0a84038

Note that unlike Scala 2 we do not need to check if the mixin part of a
Super is to a direct parent here because this is already done in
TypeAssigner.

Co-Authored-By: Jason Zaugg <[email protected]>
Co-Authored-By: Lukas Rytz <[email protected]>
@smarter smarter force-pushed the fix-super-intermediate branch from 73e33b1 to 31024d2 Compare April 30, 2019 18:24
@odersky odersky merged commit 6f89125 into scala:master May 1, 2019
@liufengyun liufengyun deleted the fix-super-intermediate branch May 1, 2019 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants