-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Need to decide how to handle forwarding semi-stubs #31649
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
Comments
Currently the front end tries to represent a semi-forwarding stub as follows:
However, after it sets this up, KernelFunctionBuilder.body= winds up setting the body to |
Note: borrowing the terminology from #31562 (comment), a forwarding semi-stub needs to have a "super target" (since at runtime there is a super method that needs to be invoked) but it does not need an "interface target" (since the interface target is only needed to ensure that analyzer navigation and error messages refer to a method that exists in the source code, and a forwarding semi-stub corresponds to a method that actually exists in the source code). |
CC: @sjindel-google |
Why can't we represent them the same way as regular forwarding stubs? I.e.:
We can add another bit to indicate to the analyzer the function existed as an abstract method in the original source. I feel strongly that we shouldn't complicate the semantics of forwarding stubs any more than necessary. |
@sjindel-google sounds good to me. I'll add it to my list to update the front end accordingly. |
@sjindel-google do you think you could add the additional bit to indicate to the analyzer that the function existed as an abstract method in the original source? ( |
I can add the bit. |
Thanks! I'll work on this as soon as I can. |
Change-Id: I93ada8e3fb00029f5af18753c62deb78b944728d Reviewed-on: https://dart-review.googlesource.com/29743 Reviewed-by: Samir Jindel <[email protected]> Commit-Queue: Paul Berry <[email protected]>
See #31649 for more details about forwarding semi-stubs. Change-Id: Iaf1153be5ac7f66503b93a362b66ac9585462f6c Reviewed-on: https://dart-review.googlesource.com/33820 Reviewed-by: Dmitry Stefantsov <[email protected]> Reviewed-by: Samir Jindel <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Paul Berry <[email protected]>
This reverts commit 379801e. Reason for revert: Broke buildbots Original change's description: > Fix handling of forwarding semi-stubs in the front end. > > See #31649 for more details about forwarding semi-stubs. > > Change-Id: Iaf1153be5ac7f66503b93a362b66ac9585462f6c > Reviewed-on: https://dart-review.googlesource.com/33820 > Reviewed-by: Dmitry Stefantsov <[email protected]> > Reviewed-by: Samir Jindel <[email protected]> > Reviewed-by: Konstantin Shcheglov <[email protected]> > Commit-Queue: Paul Berry <[email protected]> [email protected],[email protected],[email protected],[email protected],[email protected] Change-Id: I6b37f1143183e889a5b52cb8b0a5427991b306c0 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://dart-review.googlesource.com/34280 Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Paul Berry <[email protected]>
See #31649 for more details about forwarding semi-stubs. Change-Id: I2af7fb0c5de01d7732279a6ca8254985f396683a Reviewed-on: https://dart-review.googlesource.com/35003 Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Samir Jindel <[email protected]> Commit-Queue: Paul Berry <[email protected]>
I agree that we'd like to clean up all the forwarding stubs. Ideally, the analyzer would never see them at all. I don't think it's really connected to the Dart 2 stable release. |
There's an ugly corner case in the front end's forwarding stub handling logic that we need to figure out how to handle properly. I'm calling it a "forwarding semi-stub". Consider the following code (adapted from pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart):
From one point of view,
C::f
is not a forwarding stub, because it's an actual abstract method that appears in the user's source code; it's not inserted by the front end. This is the point of view that makes sense for the analyzer, since it cares only about what appears in the user's source code and doesn't need to know about runtime type checks.From another point of view,
C::f
is a forwarding stub, because it's a place where a runtime type check needs to be inserted in order to ensure that the appropriate error is thrown when code like this is executed:We need to decide how this should be represented in kernel. I will follow up with a comment with more information about how it is currently represented.
I will also add a language_2 test verifying that the correct type checks occur in this situation, as well as analyzer tests to make sure that the analyzer behaves correctly.
The text was updated successfully, but these errors were encountered: