Before this CL this code would crash fasta:
```
class A extends Function() {}
```
Now it produces a compile time error instead:
```
t.dart:1:7: Error: Can't use a function type as supertype.
class A extends Function() {}
^
```
(technically it already issued it, but crashed before doing so).
Bug: #36824
Change-Id: Iaeb9dc8390d4a9ab7b473848c3311f08a4dbba6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101283
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Suprisingly this doesn't seem to affect performance, but doing basically
the same thing in two different ways is suboptimal.
Change-Id: I1cc52bceb05a0af4d0e0d0574c3599c063cf42a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105242
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Prior to this CL, we would issue a warning whenever a CanonicalNameError
was encountered.
This is in principal a good thing, but because we currently have no way
to detect if the sdk we get is the one we expect
(by any other measure than when it issues a CanonicalNameError) we often
issue these warnings for no "real reason" whenever, for instance,
the flutter sdk changes.
This CL splits the CanonicalNameError in two such that errors with
references to the sdk ("dart:" libraries) issue CanonicalNameSdkError
instead, an we then handle that differently. Namely we silently ignore
the error (i.e. don't issue a warning) and just don't initialize from
dill.
This should remedy the situation and be strictly better than to always
swallow CanonicalNameErrors.
Bug: 36032
Change-Id: Idbae0b5ee5b9843a5dbeb49b3c65ae25f5962e36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105240
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
It seems that we don't really need to have the same elements for them
for resynthesizing element model and resolved AST.
R=brianwilkerson@google.com
Change-Id: I05efdf90671f596f2f8b85a3808eb2c4c87ea8c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105003
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
- Skeleton Rti type
- Skeleton test
- Add dependency on command-line flag to get dart:_rti into platform dill
Change-Id: Idf383269c66c9951e23fd70a45ce65c54a973586
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104921
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Also, correct source position for CheckStack instruction in the prologue of
a closure.
Change-Id: I175e5398296f17a1f67a223d45725206e65e0e8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105040
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Caused by a ternary operator with differently typed branches.
Change-Id: I5f9cfc28c274c125db0a999237f81dc3523896cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104240
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
+ emit a bit more progress info with -v
Change-Id: I60e44b2a383c8f55ef57c2a4cca98340baa66a01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104001
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This method should return `null`, since it doesn't visit an expression.
Change-Id: I018241c0d2e9b9f00bfe293352cf2707551c81e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
We need this to support existingImports filtering, because filtering
is done on suggestion basis, not on the whole suggestion set basic,
because of re-exports.
R=brianwilkerson@google.com
Change-Id: Id97cb122fa6e3c5c62e367098e1917eba997a76f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104808
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This reverts commit bb6e558534.
I found a problem with --use-summary2 in DAS.
When we implement actual API signatures, changes in bodies
change offsets for nodes, but summary2 also includes offsets,
and they don't match. So, DAS crashes. I will need to rework
offsets and other @informative data storage, so its turns
out that we cannot pretend so use real SimpleIdentifier(s)
anymore.
R=brianwilkerson@google.com
Change-Id: I1193cc3f6fd25aea1c39531e8a685b60b347166e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104949
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Change-Id: I119c44b30a1d3c6fb0d725ddb546cd3dcb31dab1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104809
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Note, this has the effect of including all DDC Dart sources with the
shipped SDK: we ship everything under sdk/lib.
This should enable https://github.com/dart-lang/build/issues/2262
Change-Id: If66bc7c620034e7f2acf7d2c3e9524a408417681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104383
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
For constant field initializers, compile the initializer expression
to Kernel, perform local type inference, and perform necessary
rewrites during outline construction. This will support constant
evaluation during separate compilation.
Change-Id: I65fe601595c04c45d586d0bac97c2ade6ab15a90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104564
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
An internal benchmark via kernel worker of lots of outline
calculations in worker mode with reuse and the incremental compiler
(and lots of dill loaded dependencies) goes from ~160 seconds to ~150 seconds.
Change-Id: I80afa10caacef5e14e569928a1d421bd3e8ab342
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104003
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
It's not sufficient to check the name of the library, since a
user-provided library could always name itself `dart.core` or
`dart.async`.
Change-Id: Id99cfc1ec89c5941e16b556e3c4dd175875a673f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
So that we can start dogfooding it.
I noticed that we logged too much data, so I reworked what we
log in LibraryContext.
Currently performance will be subpar, due to using content hash as
file's API signature. So, any change to a file, even in a method
body will cause the whole library cycle (and everything that depends
on it) invalidation. I will implement computing API signatures for
parsed unit (hopefully reusing something already existing) in a
following CL.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: Ifb77e29188484b6784edbaa6a6d5daca6800ef2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104603
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This is required because otherwise
Object() == null
requires the type signature of Object.operator==(Object o) to be
changed to Object.operator==(Object? o). Which I don't think is the
behavior we want.
Confirmation that this CL is correct has been sent to the language
team. I recommend we land, which will unblock my subtyping CL, and
roll back/readdress later if need be.
Change-Id: I498f9870e7128b2cac3012fff0cb1ab50fcc8df7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104344
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Mostly this is adding an abstraction so we can produce the jsonl files that will
allow us to track the status of each test individually.
On a separate CL I'll be moving the tests out of the current unit tests into
their own step in the test matrix.
Change-Id: Id4537db1458949370195124164b120b49a7a526c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104384
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
So, that we don't have to allocate these lists for each instance.
This makes it cheaper to have serialize more objects.
In a synthetic performance test, where we turn IDL builders into
bytes 100 times, this improves time to bytes from 45 to 34 seconds.
R=paulberry@google.com
Change-Id: Ie8c9a8ed01b4c0d4abeba96ed5e99bd430f9309d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104600
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
We don't want to keep it on while building summary1, because there
are changes in type manipulations that depend on it.
R=brianwilkerson@google.com
Change-Id: I4f84860ec197eb8f40dba80ecb51868f3d48e5e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104421
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Also made some minor improvements to the handling of method calls.
Change-Id: I8728a7901cfe61f88563b71e290e9d5b303afda1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104486
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Exception: also create hard edges for the relation between a type
argument and the corresponding type parameter bound, because that
can't be fixed by a null check.
Change-Id: I71b21ddb11c1bb1060cb6f13efde13855770e2b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104485
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reland the change to build some annotations during outlining, with a
bug fix. Annotations from patch classes and procedures were not
applied to the actual class or procedure, which is fixed.
The original commit was reviewed at
https://dart-review.googlesource.com/c/sdk/+/103806
The revert was reviewed at
https://dart-review.googlesource.com/c/sdk/+/104220
The original commit message was:
During the outline phase, after top-level type inference, compile
annotations for libraries, classes, fields, procedures, and
constructors.
Change-Id: I836160ddad4114ded72701e8a3938f703228931c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104560
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This was a lot of bookkeeping for very little added value. If we want
to experiment with changing the behavior of the migration tool in the
future, we should experimentally change it and see whether the quality
of the migration improves; it's not worth speculatively keeping
multiple behaviors around while the tool is being developed.
Change-Id: I9a59e2626be7e9e84a937e287421abcdc971aba5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104482
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Previously we were creating hard edges for the default values of
optional parameters. This was incorrect; we don't want a hard edge
because we don't want evidence of non-nullability to propagate
upstream from an optional parameter to the const expression that sets
its default value.
Change-Id: I44e12ae96987fd7a9defc538b0704cf76262473f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104500
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Rather than use an edge from `always` to ensure that these nodes are
nullable (which is error prone since it could be overridden by an
assertion), we simply place these nodes in the ordinary nullable state
at the time they are created.
As a side effect we can reduce the amount of code we have to plumb the
nullability graph through.
Change-Id: I46cf5b2026aeb2917cb35a7ad0d36a0a0562ecc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104481
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
It is unlinked summary based, we don't support it with summary2.
So, to not crash we return the empty list.
R=brianwilkerson@google.com
Change-Id: Ic220ae3526a3a3e2f06c60b4e25d7e7cef69af60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104201
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
+ assert classes and members have an output unit
Change-Id: I69749d54d79a66fea4947034458295010f83c0cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103805
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Introduce HPrimitiveCheck for checking the receiver or argument of
primitive operations. These will eventually go away with NNBD since it
will be a call-site type error to invoke `+` with a null receiver or
operand.
Change-Id: I54bf64f8231a234341c1ddf5ad4dba26909d613d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104185
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
These violations look like actual bugs and were not simply mechanical fixes.
Change-Id: I69ae67751e48829fc4733dcb327ba0aa52602c91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104063
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
During the outline phase, after top-level type inference, compile
annotations for libraries, classes, fields, procedures, and
constructors.
Change-Id: I95ca65fd58ad88d9452a28d5a0652bee44aeda3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103806
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Change some of the straightforward collections to use spreads, for
elements, and conditional elements. Many of the patterns in this file
can't be translated because they are more complex - keep the simple ones
with a declarative structure so that it is more clear when there are
extra computations or side effects that are meaningful.
Change-Id: I135b10641f61fc43ebbc4bbd7196c315339c3ee8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104103
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
We were inconsistent about using return and argument types with
overridden methods. It is technically safe to omit them since they'll be
inferred from the super class - but it's more explicit and readable to
repeat them here. We were already using types on some of the overrides -
add them to the remainder.
Change-Id: Id8529e40a80c8ff3d5feb231a37a12d3d6487b4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104160
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
The test is failing, for now I plan to just land the test in its failing test and change the status once it starts passing.
Change-Id: I305c32cc7a163e280bdb766f29835264c331c9ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103680
Reviewed-by: Vijay Menon <vsm@google.com>
Add specific error text for the dynamic call failure cases:
* Calling null.
* Calling an object instance with a null `call()` method.
* Passing too few or too many arguments.
* Passing incorrect named arguments.
* Passing too few or too many type arguments.
* Passing type arguments to a non-generic method.
This does not address the issue of a missing name. The errors still just
reference 'call'. Tagging a name could be added in a future change.
Issue: #36165
Change-Id: I21592ef506908559da0bfe9aac5ed5bae7fcb84e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103645
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This adds support for BabelJS to test.py's dart2js compiler
configuration. When --babel is specified directly or through a named
configuration, test.py will run an additional step after dart2js that
post-processes the javascript output by running it through BabelJS with
the specified Babel configuration. BabelJS is added to the DEPS in its
standalone form. d8 is used to run BabelJS standalone to avoid adding
a dependency on NodeJS. d8 can only write to stdout but not to files or
stderr, which makes it necessary to change the test_runner to handle
commands that expect their output to be piped to a file.
Changes:
* Add --babel option to test.py.
* Add babel option to pkg/smith.
* Switch IE11 builder to use babel transformation.
* Fix option list comparison bugs in pkg/smith.
* Change dart2js compiler configuration to generate files using the
test name rather than just "out.js" (update test that relied on this).
* Remove runtime_configuration dependency on test_suite.
* Remove obsolete blocks adding --preview-dart-2 dart2js arguments.
* Make dart2js' compiler configuration more like DDC's.
* Remove createCommand method that is no longer used.
* Remove support for "OtherResources" which was only used for
dart:isolate tests on dart2js and DDC.
* Skip co19_2 tests that are slow to transform with babel.
* Simplify the timeout handling in the test runner with Future.timeout.
Change-Id: I32e4917b2a57ecbe684538e40d744f0101c552a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/90402
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
The new HBoolConversion instruction can be removed after the NNBD transition is complete.
Change-Id: I136c23f10440cb2414db32e5054b743714f7116b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103681
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
* Source file location
* Assertion source code
This change embeds the information as strings into the compiled source. In the
future we could reconstruct the source file location at runtime from the stack
trace.
In tests with various large applications this added roughly 1MB (0.1MB
compressed) or less to the compiled file size.
Fixes: #36995
Change-Id: I2634f7eab6e54eec209094b52429987dd62c0828
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103568
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
I deprecated 'abstract', but I don't see any uses of it outside of
analyzer, which I have fixed. So, maybe we should remove them right now?
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: Ifd86a6b0148be49df6455672742f825ffd50f661
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103661
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
When the .packages file has changed we need to re-check all package-uris
to see if we need to invalidate the builders (if the file uri for a
package uri library (e.g. if the package was upgrade) has changed we
have to invalidate it).
This translation is semi-expensive though, so if we can avoid it that
would be a good thing.
This CL caches the "base URI" for packages from the previous run,
so we can start by comparing the base-URIs: If the base-uri for a
specific package hasn't changed, nor will the actual translation.
Only if the base uri has changed we do the actual translation,
and thus save many package-to-file-uri translations.
An internal benchmark via kernel worker of lots of outline
calculations in worker mode with reuse and the incremental compiler
(where the .packages file change every time and we have lots of
package-uri libraries) goes from ~185 seconds to ~162 seconds.
Change-Id: I3ed48b23a590dbf66f8a2379bb88e1b177f1f034
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103804
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Before this CL we removed from from the builders map, but left them in
the libraries list.
When using the incremental compiler via kernel worker (where we
continually replace dill builders) that meant that this list would just
keep growing.
This CL cleans it up and the builders map and the list should now be
in sync
An internal benchmark via kernel worker of lots of outline
calculations in worker mode with reuse and the incremental compiler
goes from ~215 seconds to ~185 seconds.
Change-Id: I254558d517f544fe31b5673e0dc8748048f0c5ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103630
Reviewed-by: Kevin Millikin <kmillikin@google.com>
This was a left-over from when unbinding, and should no longer be needed.
An internal benchmark of lots of outline calculations in worker mode with
reuse and the incremental compiler goes from ~248 seconds to ~215 seconds.
Change-Id: Iedb6a3fb11504610c061503efb741e35919f0d32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103629
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Merges InlineWeeder and InlineReductive into one visitor and computes
an InlineData object from which all decisions can be made.
Next step is to compute InlineData in the scope visitor (the first visitor
of the first modular phase).
Change-Id: I0c435ae1b3d7afdff1cee7abac657c9362995a67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103632
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This avoids (yet another) inconsistency from the imprecision of
called once. In this case the inlining of some methods that are
called once is dependent on whether we meet their call-site directly
or indirectly first, effectively making the inlining decision subject
to the enqueuing order.
Change-Id: I8d6b9c18fdb82f6d1b566e6bb58344211678daf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103631
Reviewed-by: Sigmund Cherem <sigmund@google.com>
A negative result was wrongly returned as a positive value.
Since positive values are preferred, the implementation now adds the modulus
enough times to make the result positive.
Change-Id: I87a2ceb359345846740a749ab6b46b1d45e7ba21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103664
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
This adds quite a lot of information though, because we send many
strings.
Before: 20686 characters.
After: 55345 characters.
Theoretically we could do better, and send information about existing
imports only once as well, so when the user continues typing in a
single file, without touching imports, we don't send any new data
about imports (maybe just a confirmation that it is still the same).
But I'm not sure if this is a worthwhile optimization.
Actually, even included suggestion sets have similar property - they
don't change for a given file, unless there are changes to other
libraries which we might want to include.
R=brianwilkerson@google.com
Change-Id: I2f55e2dc85508849146aa39eb279beabaec937c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103561
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
+ and use it in the dart2js modular tests
Change-Id: I66cf29dcea7fb705135049e7a6ea4eb17052f3d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103575
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This includes:
* accepting null values like sdk-summary or .packages (which are not used when building kernel for the sdk itself)
* allow enabling language experiments
* only exclude-non-sources on the non-incremental code path if that's requested
Change-Id: I08eeb643676f1f1406f0f3030c341d68179d42a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103574
Reviewed-by: Nate Bosch <nbosch@google.com>
This builds on the prior CL to improve the error messages
for missing switch statement body, missing finally clause body,
and others.
Change-Id: Ia2def1f3a75d5581356c12aee4705ef21870f749
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103571
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This improves the missing class, mixin, and extension method body
error messages and lays the groundwork for improving other
missing body error messages such as switch statement, finally clause,
and others.
Change-Id: I0a4d1338fe91eee3cfe7d61652e168df1302d212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103570
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
When performing type substitution, there are three types involved, the
substitution site (`this` in TypeImpl.substitute2), the type we are
replacing (`parameterType` in TypeImpl.substitute2), and the
replacement type (`argumentType` in TypeImpl.substitute2).
Previously, we only handled the nullabilities of `this` and
`argumentType`. This CL adds support for the possibility that
`parameterType` might have nullability "*". This happens because
TypeParameterElement.type returns a star type, so for instance when
subsituting `int` for `T` in `List<T>` to form `List<int>`, we are
actually substituting `int` for `T*` in `List<T*>`.
Change-Id: I0a61fdc47ec8aa205dc0c539c49ea7799ed4ac05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103542
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
For analyzer backend only:
* Implements `x!`
* Uses non-null type info where possible to elide null checks.
* Does not yet reify.
No hurry on this - starting to look at what's there. Some notes:
* NNBD doesn't seem to be exposed directly on DartType yet.
* x!.y doesn't seem to parse - need to write (x!).y.
* Can't run existing tests yet - `package:expect`, etc., have NNBD errors.
Change-Id: I58c24c950d00f3a40d789d4a7adf049786977c50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103040
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
During outline building the token stream was split after every field
initializer needed for top-level type inference. Since the token
stream is a doubly-linked list it's also necessary to split the token
stream before the field initializer in order to possibly collect the
unnecessary tokens.
Change-Id: Iafac8eee1eb87d43458f66ef08f6398634ded5df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103622
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Add flags for extension-methods, non-nullable, and triple-shift.
Change-Id: I42d2afbe1b3353a18da8cdfec1fded3ad6694e3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103620
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Introduce an annotation builder that will eventually be used to
compile Dart annotations to Kernel in outlines.
Change-Id: If882ce27b6012001c04257b867b5dcc596a72105
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103621
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
These builders have some unused generality: they have an unnecessary
type parameter and the implementation classes have unused fields. As
currently used, they could be replaced with an int but the class is
kept in anticipation of adding behavior (compiling annotations).
Change-Id: I068cb483a19b3f7eae846c212cbdbb29ca77973d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103529
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
This reduces the size of the serialized codegen data by 20-25%
Change-Id: I85424576d68b72a56c3c924fe704a086000bc926
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103534
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
There are minor fixes for dartkb and windows.
The original revision is in patchset 1.
Change-Id: I9ab6e5fdb33fb4e84ea520c283fe94323616a8ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103129
Commit-Queue: Samir Jindel <sjindel@google.com>
Auto-Submit: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
This is important as we will soon add support for compiling the sdk as a
module and we would like to only compile it once when running a suite of
tests.
+ also enable caching in the dart2js pipeline test.
Change-Id: Ic9043f868123164f3ab425ba73f7428416b05fc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103485
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
I need to make changes to 'collectApiSignature' and 'flushInformative'
to support variants, and we have lots of code around already.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: I9ba3b61a22b9e9e2c547e97d5c5adaa07443b24a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103552
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
HBoolify was used in Dart1 unchecked mode.
Change-Id: I1cdbff515fc7446c67fc255bb9599dee79dfd242
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103569
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This type is equivalent to the existing type `Null`, but we need it
anyway because `Null` can only be accessed via the type provider, and
there are circumstances where we need to create this type and don't
have access to the type provider.
It also may prove beneficial to be able to distinguish between `Null`
and `Never?` in diagnostic messages.
Change-Id: I6118e87c8c4736a508a3f366f2762a96198db7ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103540
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This is an incomplete parser implementation of extension methods.
Subsequent CLs will flesh out the details.
Change-Id: I8c891827e97b451388cadc9cedea3afb7a8cf922
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103464
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Hitting this when compiling the analyzer with DDC. I thought this was exercised
when training the DDC snapshot (it compiles itself), but it seems not.
Lost the assignment here on the recent implicit cast removal.
Change-Id: Id1a74999c75b2a36071bac3692c2022e7ad7eefe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103482
Commit-Queue: Vijay Menon <vsm@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Vijay Menon <vsm@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Hitting this when compiling the analyzer with ddc. Should sanity check that our bots are
running with assertions enabled.
Change-Id: I1276b936162f3adc830a79d1f014c6dccd80de86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103461
Auto-Submit: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
Only ~29/100 calls for runtimeCall and ~2/31 calls for runtimeStatement
were using the single value option. Change to take a `List<Object>`
always and add list literals to those calls which were previously only
passing one value.
Update pubspec SDk constraint so that the analyzer will allow the `..?`
syntax.
Change-Id: Ib8eb8eb854a8aa04e36dc5cc713016a43b8e9325
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103361
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
The VM uses the collection and set literal transformations. The set
literal transformation assumes that collections have already been
transformed. This was not done correctly when translating a
list (e.g., constructor initializers).
Fixes https://github.com/dart-lang/sdk/issues/37027
Change-Id: If7a6bda55f8cf0efd761fd8932d3a9e2c60db19b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103134
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Resolution is incomplete at the time when we perform rewriting.
For example, in `C<int>` the type of `int` is not set, so we get
incomplete InterfaceType of `C` with `null` as the type argument.
This was crashing summary2 in one situation internally.
R=brianwilkerson@google.com
Change-Id: Ifcff68f007a90b5694cf3e4e4d3825309c04e2b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Explicit casts make it easier to confidently navigate the code base and
apply refactorings which tighten types. This change exposes a number of
places where types can be tightened, but only the most trivial were
applied. For most places I added the explicit cast that would have
happened anyway and so behavior shouldn't be changing.
- Add the configuration which disallows implicit casts in the analyzer.
- Add explicit casts in almost all instances.
- Where the implicit cast was due to a local variable type on the left,
change it to a `var` so the type is not repeated.
- In a few places add argument types where they were already applied on
the parent type, and the subclass was unnecessarily loosening argument
types to dynamic.
- In a few places where a method was defined with an implicit dynamic
return but had an obvious and consistent return type, annotate the
method instead of casting after calls to that method.
Change-Id: I90e11b1cc08ce69967ea5705b507d5758a8f668f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103381
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This fixes the Astbuilder recovery when encountering "get <identifier> :"
in a class body to build a method node rather than a constructor node.
Fix https://github.com/dart-lang/sdk/issues/36961
Change-Id: I48242838d72c3a6c18e78a469b6e07fd1481d0c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Now that we assign indexes to occurred GenericFunctionType nodes, we
need to make the order consistent across all visitors.
R=brianwilkerson@google.com
Change-Id: Ifc9c7bfa35612cef235f000f30130d36116067e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Change-Id: I7c85a642eeaa862ecf9c6837c0a488938e8d97e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101225
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
This CL fixes a number of issues:
* Semi-leaking old components when starting over
(i.e. when loading a new sdk)
* Setting new filesystem not really working because the old one was
cached in the ProcessedOptions
* Leaking old state because of an apparent VM bug (http://dartbug.com/36983)
Change-Id: Ib124257c456b019941e253409c1ef56eedcf66b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103121
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This is needed to activate the kernel transformer embedded with the kernel package from the flutter engine.
Change-Id: I3253e01723b662eb48b4b3743ac5bcc1b44c7d46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102920
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jacob Richman <jacobr@google.com>
Working towards turning on all lints from package:pedantic. This change includes
the lints that needed cleanup and don't change any behavior.
Applied cleanup:
* Don't explicitly initialize variables to null.
* DO use curly braces for all flow control structures.
* Use `.isEmpty` instead of `.length == 0`.
* Use `.isNotEmpty` instead of `.length > 0` or `! .isEmpty`.
* Use `=` to separate a named parameter from its default value.
The remaining lints from package:pedantic will require cleanup that is less
automatic and will be addressed in later changes.
Change-Id: Ie4c3ba685f8a559209dd14ac037203ecd16252c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103086
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Some changes in indentation for adjacent string literals and a case of
formatting inside string interpolation.
Change-Id: I30eb9b9e891a11a54f89351e0f2d4c0172e69066
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103161
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
These aren't useful to see cluttering up diagnostic lists - they can be
found easily enough in other ways.
Change-Id: I34b800c1145ae476822afddff558d62c4ffb9b2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103141
Reviewed-by: Mark Zhou <markzipan@google.com>
Previously 36% of overrides were annotated, including inconsistent
annotations within a single class.
- Add annotations on remaining overridden methods.
- Add linter section to `analysis_options.yaml` so that missing
annotations are visible while editing.
Change-Id: Ief1a6d5b8da6f4b630a6cfc72a6ed67db346c081
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103140
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
The serialization/deserialization is performed in test-mode.
Change-Id: I90f31a6a88dbdf2c38beb9b5409ce3c52557e227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102740
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Note, that this will start building it always, regardless of the
state of the useSummary2 flag.
Summary1: 4892680 bytes.
Summary2: 7105744 bytes.
Both: 10748992 bytes.
Time:
Summary1: 2550 ms.
Summary2: 2750 ms.
Both: 4000 ms.
Change-Id: If81367c24654c1d57a4dcdbd42f76d80ae8c4b39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102540
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
It doesn't work to make TypeParameterElement.type choose
nullability/non-nullability based on the enclosing library, because
for type parameters of synthetic function types, there is no enclosing
library.
Change-Id: Ic74cc639534e3c03f3c46e7eacfb5655ca74019a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102981
Auto-Submit: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
1. Read GenericFunctionType fully, but in two steps to avoid recursion.
We need to read it fully, because it might be a part of a const
initializer, so the client might request the initializer expression,
and there is no way to him to finish reading. Amnd in general, we
don't read expressions lazily.
2. For consistency we need to set identifiers for all GenericFunctionType
nodes that we want to store. So, DeclarationResolver should be updated
to move the identifier number even though we don't use the same
mechanism for building elements ininitializers, as we use for type
annotations outside expressions.
R=brianwilkerson@google.com
Change-Id: I58faa5408bff5250a8c775249438def7f742594b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102840
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
At this time this only compiles to .dill and then compiles from multiple modular
dill files.
Next steps: add the global split and add the modular data bits
Change-Id: I3399776dbd5187ddb0a3e2fdd307622a736570c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102126
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
package import uris
THis is not actively used in the loader unit tests yet, but will be in the
dart2js pipeline.
Change-Id: Ie0db6243c735e2fba396f2a5a156d52ea1e53bbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102125
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This CL revises the scanner API so that tokens are always prepended
to the beginning of the token stream. This allows the parser handling
of error tokens to be simplified. Any clients using the scanner directly
rather than through the scanner API should call scannerRecovery
if the scanner has detected errors in the content.
Change-Id: I32510da10205bd964f80898a238489d1508733e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>