-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Kernel representation of forwarding stubs needs to point to "actual" interface target in outline #31519
Comments
@scheglov FYI |
This is now high priority for Analyzer integration. We handle enough nodes that this is now the first issue we stumble upon when analyze a big codebase. |
Here's an idea as to how we might unblock Konstantin while waiting for this kernel feature to be implemented: we could add the necessary information to the front end's @scheglov @kmillikin What do you think? |
SGTM! |
Clarification: there are two things one might mean by the "actual" target of a forwarding stub:
Consider: class A {
void f(int x) { ... }
}
abstract class I {
void f(covariant Object x);
}
class B extends A implements I {}
In this bug I believe the target we're talking about is the interface target. |
CL containing the proposed workaround is here: https://dart-review.googlesource.com/c/sdk/+/27460 Note: this is slightly different than what I suggested previously. Instead of storing the necessary information in the front end's if (interfaceTarget is ForwardingStub) {
interfaceTarget = ForwardingStub.getInterfaceTarget(interfaceTarget);
} (There is no need to do this in a loop; the member returned by |
This is a temporary measure to allow the analyzer team to make progress until #31519 is fixed. Change-Id: I056505ed0308c5b2ea3e3664a8943549c3c8548c Reviewed-on: https://dart-review.googlesource.com/27460 Reviewed-by: Kevin Millikin <kmillikin@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
Thank you! |
Current status: Paul's workaround with using This is blocking Analyzer integration. |
Added Samir as assignee, since he touched the code necessary to fix this bug recently - see https://dart-review.googlesource.com/c/sdk/+/31921/5/pkg/kernel/binary.md#358 |
First step in fixing issue #31519. Change-Id: I8df86954993ae5edd59ad2edc57179725880c1d9 Reviewed-on: https://dart-review.googlesource.com/34143 Commit-Queue: Samir Jindel <sjindel@google.com> Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
I've added the field for this parameter; however, I think someone more familiar with the current hack should remove the |
Consider the following program:
This compiles to the following kernel representation:
Note that the call from
bar
tob.foo
has an interface target ofself::B::foo
, which is a forwarding stub.When the analyzer builds its resolution information based on the kernel representation, it can't consider the call to
foo
to resolve toself::B::foo
, since there is no such function in the user's source code.It needs to resolve it to
self::A::foo
, the method that would have been the interface target if the forwarding stub hadn't been there. It can't get this information from the body ofB::foo
for two reasons:(1) In a separate compilation scenario, the body of
B::foo
may not be present when analyzingbar
; we may only have an outline forB::foo
.(2) In certain circumstances a forwarding stub is created that lacks a body, e.g.:
which has the kernel representation:
So we need the kernel representation of a forwarding stub to contain a pointer to the interface target that would have been used if the forwarding stub had not been there; and we need this information to be present in the kernel outline. The analyzer can use this information to find the "actual" (non-forwarding) interface target.
The text was updated successfully, but these errors were encountered: