The outer loops are now through the arguments of the method to be
fixed, and the inner loops are through the inherited methods. This
allows us to handle the situation where a forwarding stub is needed
because isGenericCovariantInterface changes from true to false, but
the forwarding stub doesn't need to be concrete, since
isGenericCovariantImpl is inherited from the base class. (Previously
that situation didn't work because by the time we processed the
inheritance of isGenericCovariantImpl, we had already created a
concrete forwarding stub).
Additional fixes in this CL (necessary to get tests to pass in
meaningful ways):
- Updated InstrumentationValueForForwardingStub to print covariance
annotations on type parameters.
- Updated _createForwardingStub to copy covariance annotations from
the target procedure to the procedure being created.
- Moved call_through_this.dart from runtime_checks/ to
runtime_checks_new/ because the analyzer implementation doesn't
handle this case correctly.
Change-Id: I984a46826a3a4d8ad1a1ce840269498df049fef0
Reviewed-on: https://dart-review.googlesource.com/13963
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
When multiple fixes need to be inserted at the same offset, they need
to be inserted in reverse order, so that they will be in the correct
order in the final file state.
Change-Id: Ifa976c7cb5548869f9f7fcfff2d89ffb2110b882
Reviewed-on: https://dart-review.googlesource.com/13962
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Also remove KernelProcedureBuilder.prepareTopLevelInference, whose
sole purpose was to populate it.
Change-Id: Id42e931ebe6a2b9da4f30e54fc3d33627f84a5b7
Reviewed-on: https://dart-review.googlesource.com/13581
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This addresses the situation where a top level built-in keyword
such as "import" or "export" is used as an identifier
in a top level declaration.
Change-Id: I663ed00502eadd2c639f79e68d26345783911faa
Reviewed-on: https://dart-review.googlesource.com/13361
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Previously, we created genuine kernel objects to represent the
synthetic setters and getters associated with fields. This led to
problems, because a given field would have multiple synthetic setters
and getters associated with it, and those synthetic getters and
setters would fall out of sync with each other during type inference
and covariance propagation.
This CL changes the kernel objects representing synthetic setters and
getters so that they are proxy objects; they inherit most of their
functionality from the corresponding kernel representation, but they
override the properties having to do with types and covariance so that
they refer to the underlying field. This ensures that nothing gets
out of sync, since the field is the single source of truth about its
type and covariance.
Change-Id: Iff44c408e84ef34df337c81e7bfbd125d61020d8
Reviewed-on: https://dart-review.googlesource.com/13281
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
With this CL, we stop creating the old AccessorNode objects and start
creating the inference nodes associated with the new ForwardingNode
infrastructure. This fully integrates top level type inference with
forwarding stub generation.
There is a small difference between the behavior of the old and new
type inference infrastructure: in the old infrastructure, when
inferring the type of a getter or setter, we would consider both
inherited getters and inherited setters. Now, we follow the spec.
This introduces some minor differences from analyzer functionality, so
the tests of this functionality are moved into the "inference_new"
directory.
Change-Id: Ie17df9abf1a3ab99e7d22683ffdf6d1b13ec86be
Reviewed-on: https://dart-review.googlesource.com/13180
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This required adding a few extra parser events to allow the type
propagator to update its state when the `?` and `:` are encountered
(similar to what was done for `if`).
Fixes#30620.
Change-Id: I0d3ede8056fd8bab01ead5b242d00803286c9373
Reviewed-on: https://dart-review.googlesource.com/13182
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This will be necessary when we try to integrate type inference with
the creation of forwarding nodes, because getter types can be inferred
from inherited setters and vice versa.
We accomplish this by producing two separate lists (getters and
setters), then merging them together. This results in a list where
correspondingly-named getters and setters are grouped together, with
getters appearing before setters.
Change-Id: I549f0b4354370753a6aa7a15285d778980fb4841
Reviewed-on: https://dart-review.googlesource.com/12900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Every time we look up a member during type level type inference, we do
so because we need the type of the looked up member. So rather than
look it up and then trigger its type to resolve, we simply resolve it
as part of the lookup.
Change-Id: I0428649fbc99966dae1c0c3a04b6c5e4f680c9ab
Reviewed-on: https://dart-review.googlesource.com/12840
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
It doesn't make sense to use the full type inference machinery for
setting the return types of setters to `void`. Just do it directly in
the builder.
Change-Id: Ia20671b17b77c758519f813d40285d9795fea6ea
Reviewed-on: https://dart-review.googlesource.com/12743
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
AccessorNode is changed to inherit from InferenceNode, and the logic
for coping with circularities is moved into the base class (with some
refactoring).
Change-Id: Ie505e40f2ede344a168878759bba05aa704e0c4b
Reviewed-on: https://dart-review.googlesource.com/12740
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This allows covariance information to propagate properly between
classes and avoids creation of unnecessary forwarding stubs.
Change-Id: Ib55c62adb74d16f94282e752e387634086001946
Reviewed-on: https://dart-review.googlesource.com/12600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This is necessary because we will need to consult fileOffset and
fileUri in order to make covariance annotations.
Change-Id: I989393cd3f66c0875b4e8e091c7a8d7523a08b20
Reviewed-on: https://dart-review.googlesource.com/12422
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Two changes:
- ShadowClass.getClassInferenceInfo now accepts an ordinary class, and
returns `null`. This will allow us to ensure that if a ShadowClass
gets re-used later as an ordinary Class (which sometimes happens
during incremental analysis), it will behave the same as an ordinary
Class.
- We don't create ShadowClass._inferenceInfo at the time of
ShadowClass creation; we wait until a builder is stored. This will
allow ShadowClass objects with no inference info to be easily
created in unit tests.
Change-Id: I0dd2d65b0c477b069ec36872c13b19ba8ebbd021
Reviewed-on: https://dart-review.googlesource.com/12382
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This is necessary because the need for a forwarding stub may be
affected by the types of inherited accessors, and the types of
inherited accessors may need to be determined by type inference.
Change-Id: I160cf21186485d2572301f3cda8621ede517c47b
Reviewed-on: https://dart-review.googlesource.com/12400
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Previously we were using the presence or absence of an AccessorNode to
determine whether the field was implicitly typed. But AccessorNode is
going to go away soon, so we need a boolean.
Change-Id: I7ef5bfb8be25f753fa674472b72d7bef0d3a2baf
Reviewed-on: https://dart-review.googlesource.com/12380
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Soon, inference of instance fields will be unified with the logic for
creating forwarding stubs. When this happens, we will need the order
of inference to be:
1 Finish top level inference of static fields.
2 Finish top level inference of other fields, and create forwarding stubs.
3 Finish top level inference of initializing formals.
Currently, (1) and (3) are performed by the same method,
finishTopLevel(). Splitting it into two methods allows us to put (2)
in between.
Change-Id: I70e1a47e8ad604bdb8f0348c54d6017c0a0b57b5
Reviewed-on: https://dart-review.googlesource.com/12381
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>