This will simplify integrating top level type inference with the
InterfaceResolver, since the instrumentation logic won't have to be
migrated.
Change-Id: I89a23888d92622549c493249fd3d98c6ee5af8da
Reviewed-on: https://dart-review.googlesource.com/12124
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Also extend the verifier so that we won't make mistakes like this
again in the future.
Change-Id: Idbdf02dabed8b8cf86cb0b8a1fc08080338b9709
Reviewed-on: https://dart-review.googlesource.com/11961
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This separates compiling platform.dill files from the patch_sdk.dart
script. The motivation for that is that I'm working on reading patch
files directly from Fasta, so we can completely remove the build step
for generating patched_sdk and dart2js_patched_sdk.
Short-term this should allow Paul to add a strong-mode version of
platform.dill without causing to many conflicts with my work on
patches.
Change-Id: I1150845b2986348d4fffe27092701d8a9b57ea54
Reviewed-on: https://dart-review.googlesource.com/11506
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This allows creating strong mode TypeEnvironments without actually subclassing
it.
Make SubtypeTester.isBottom treat Null as Bottom in strong mode.
Bug:
Change-Id: Icdd1a4b736ce0fe839a6ef30cf24487111f32d25
Reviewed-on: https://dart-review.googlesource.com/11882
Reviewed-by: Paul Berry <paulberry@google.com>
We don't need to supply the dependent node every time we call
inferAccessorFused; we can just let TypeInferenceEngine keep track of
which type inference node (if any) is currently being inferred.
Change-Id: I75b222ce038ad31c196aeb9c33b315731f4f1c52
Reviewed-on: https://dart-review.googlesource.com/11700
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Type inference of methods now occurs during
SourceLoader.prepareTopLevelInference. Since this method visits
classes in class hierarchy order, we no longer need special logic to
ensure that base classes are inferred before derived classes.
Change-Id: Idf9f67226005bee6986d026c255e83926b4253d6
Reviewed-on: https://dart-review.googlesource.com/11560
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This CL handles the case where a class overrides a concrete method
with an abstract one, but forwarding stub logic determines that a
concrete method is needed. In this case we don't need to create a
full forwarding stub; we just need to add an implementation to the
abstract method that already exists.
We annotate this case as `/*@forwardingStub=implementation*/`.
Change-Id: Id0b0c6f84f666161f17942d3b4d7afc115c615f5
Reviewed-on: https://dart-review.googlesource.com/11367
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
We only need to retain long-lived forwarding nodes for getters and
setters; methods and operators can be resolved immediately, since
their resolution can't depend on top level type inference of
initializers.
This should help speed up InterfaceResolver by reducing the number of
long-lived objects it leaves in the heap.
Change-Id: I05f8d5ed1c12968f4382d43ae23955171cdbfc05
Reviewed-on: https://dart-review.googlesource.com/11241
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This updates the fasta parser to handle out of order clauses
in the class header similar to analyzer.
Also:
* Fix parseTopLevelDeclaration in parser test proxy
* Fix parseStuff to correctly update token stream
* Extract skipUnexpectedTokenOpt
Change-Id: Ic20c0ab1355e866aa241c591ceeada390890c46a
Reviewed-on: https://dart-review.googlesource.com/9880
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This CL replaces outdated VmTarget and FlutterTarget with VmFastaTarget
and FlutterFastaTarget. 'Fasta' suffix is droped from target names.
The new FlutterTarget extends VmTarget, so they share more code.
Change-Id: Id79956698a889c9a49b8a67914f1f96a731407ab
Reviewed-on: https://dart-review.googlesource.com/9423
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
When creating a forwarding stub for a method like this:
class C<T> {
void foo<U>(T x, U y) {}
}
class D<V> extends C<V> {
// Forwarding stub needed here
}
Two substitutions need to be done:
- We need to substitute V in place of T.
- We need to substitute the generic parameter for the forwarding stub
in place of the generic parameter for the method being overridden.
So the generated method should look like this:
class D<V> extends C<V> {
void foo<W>(V x, W y) => super.foo<W>(x, y);
}
Change-Id: Id846611c499b9aad4f042380862cbad08a6f1c17
Reviewed-on: https://dart-review.googlesource.com/10581
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
When a variable declaration in a for initializer has an error,
an error-throwing expression statement is produced by the general
variable declaration parser code. The body builder was not prepared
for this, but was trivially extended to handle it.
Closes https://github.com/dart-lang/sdk/issues/29984
Change-Id: Iace9a095cc150e26e62ed17716823e62e5d2ece3
Reviewed-on: https://dart-review.googlesource.com/8801
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
This will make it possible to delete CovariancePropagator without
regressing covariance instrumentation too badly.
Note that there are some small regressions due to the fact that
InferenceResolver doesn't yet correctly propagate covariance
annotations from a base class field to a subclass field/setter. These
regressions can't be fixed until after InferenceResolver is integrated
with top level type inference.
Change-Id: I29352484e9f13bbfa9b34d463c6b27eab7f9698f
Reviewed-on: https://dart-review.googlesource.com/10200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
For the moment there is some duplicate functionality: both
InterfaceResolver and CovariancePropagator will try to propagate
covariance annotations. This is ok for the short term, since
InterfaceResolver is still incomplete. Once InterfaceResolver is
complete, I'll remove CovariancePropagater.
Note that forwarding stubs are now created, but they are not yet added
to classes, so they don't appear in the compiled kernel output.
Change-Id: I0a1814bd2abc5b63dbf7ceb6fc45f3da81728ee9
Reviewed-on: https://dart-review.googlesource.com/9788
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Refactored the parseClass method in preparation for
adding recovery, updating error messages, and analyzer integration.
* Added several new parser events
- handleClassExtends
- handleClassImplements
- handleClassHeader
* Revised the endClassDeclaration event
Change-Id: Ib58893097650eefb45051b462e9df7260b7776b2
Reviewed-on: https://dart-review.googlesource.com/9580
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This should fix the issue 30917 flakiness.
The reason why the tests were failing is that the code in the tests
was not quite correct Dart code, so Fasta generated a synthetic
`#errors` top-level variable with fileUri == null. We should skip
this field because it is not a part of any unit, because its fileUri
is not the fileUri of any unit.
But we lose fileUri for a Node if Program.uriToSource does not
include this URI. So, if we clear uriToSource in KernelDriver, we
lose all the file URIs. So, now we keep sources for the cycle files.
The reason for flakiness is because of the same race condition
between analyzing AnalysisDriver.addFile() and getResult(). If
we process getResult() before, we don't have to read the library
kernel file, we just create in first time, and fileUri(s) are
valid.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
Bug: https://github.com/dart-lang/sdk/issues/30917
Change-Id: Ie559cf2a8a778ebf4a9e297f5cb13d30a98b5a3c
Reviewed-on: https://dart-review.googlesource.com/9744
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
* `as` clause and `deferred as` clause processing pushed
into a new processImportPrefixOpt method.
* New handleImportPrefix event for communicating
`as` clause and `deferred as` clause to the listeners.
* Several new more detailed error messages for out of order
clauses and keywords in the import directive.
Change-Id: I133842c7225403fa000ca1cf0e49af9f8a011386
Reviewed-on: https://dart-review.googlesource.com/8580
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This is necessary for two reasons:
- Sometimes we need to create a forwading stub that is abstract.
- Sometimes a class has an existing abstract member that needs to be
given an implementation.
Change-Id: I1fdb91ff421c1cd1234141db9c9b2190870164fa
Reviewed-on: https://dart-review.googlesource.com/9121
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>