Skip to content

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

Merged
odersky merged 1 commit into
scala:masterfrom
dotty-staging:fix-super-intermediate
May 1, 2019
Merged

Fix #1392: Disallow super-calls that cannot be implemented correctly#6407
odersky merged 1 commit into
scala:masterfrom
dotty-staging:fix-super-intermediate

Conversation

@smarter

@smarter smarter commented Apr 30, 2019

Copy link
Copy Markdown
Member

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 jzaugg@gmail.com
Co-Authored-By: Lukas Rytz lukas.rytz@gmail.com

@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 <jzaugg@gmail.com>
Co-Authored-By: Lukas Rytz <lukas.rytz@gmail.com>
@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