This CL:
* adds a test that runs the VM with old dills (compilations of dart2js
with old checkouts) with the --compile_all argument (1).
* adds a number of old dills (for binary version 25, 27, 28, 29)
(by mistake binary version 26 sort of didn't really happen)
* adds a PRESUBMIT check in kernel that verifies that we have an
"old dill" for the current binary version, so one don't bump the
version without creating a new dill.
(1): It uses --compile_all to force the VM to "read and understand"
everything in the dill file. The hope being that we try out
all/most language constructs and thus verifies that they can be
read by the VM.
Old "old dill" files should be removed once the VM stops supporting that
version. That is a manual process, but a test should complain that the VM
cannot read the old "old dill"(s) once/if that happens.
This should (help) detect errors such as the one recently where a merge
error caused a single "if >= 28" (that should have been "if >= 29" and
thus stopped the VM from reading dills from version 28) to slip through
and require a lot of debugging a few days later.
Change-Id: Id79e16c7ad896c0ccc4e181465b05b67822ac31a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113698
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Add support for the `late` modifier on fields and local variables in
CFE, and `required` on named parameters When using the option
--enable-experiment=non-nullable the `isLate` and `isRequired` flags will be set
accordingly on Field and VariableDeclaration nodes.
Closes#37686Closes#37684
Change-Id: If37fc93defdabc5cc974f3f068f57752a665f4cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113036
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Adds Extension node to kernel/ast, currently with serialization. This
is needed to support resolution of extension methods through dill
boundaries.
Adds (Source)ExtensionBuilder for build Extension nodes and
DeclarationBuilder as common superclass of ClassBuilder and
ExtensionBuilder.
Change-Id: Id945a40452f2729f9a4f390477dd6c76f9030eaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112256
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This CL adds a simple spell-checker, adds a spell-checking-phase to
messages_test to spell-check our messages, adds a new test that
spell-check our dart-code and fixes a lot of spelling mistakes / typos.
Change-Id: I8943a5bd67970e9a8a775251ae0aa97799eab097
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112346
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
When we perform constant evaluation in the CFE, the async transform
runs after constant evaluation. Thus, it can no longer use const
bool.fromEnvironment("dart.vm.product") to query whether the VM is
in product mode.
Instead, it can read the product mode define directly from the
environment defines given to the CFE and generate different code
depending on the value.
Change-Id: I2aabc4a84b50a940d35d5664ff4ebdf0680ed5c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111645
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Adds synthesized type variable builders and formal parameter builders to
the procedure builder. This ensure that both the outline and body
building correctly resolve extension type variables and extension this types.
Change-Id: I55d5665286dafedb4e47316faafb32ddb6cc33d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111730
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Handles property access, update and method invocation on explicit and
implicit this in extension methods. Also use ReadOnlyAccessGenerator
instead of ThisAccessGenerator to handle explicit this.
Change-Id: Ifd6861b1f931f854a39ddfb9ddae35ebf6094327
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110904
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This change ensures that instances of UnmatchedToken are always prepended
to the token stream. This should prevent the exception that occurs in
https://github.com/dart-lang/sdk/issues/37491.
This addresses only one type of error token and we may see a similar
exception with other types of error tokens.
Future CLs will prepend other and eventually all error tokens.
Change-Id: I99cdc331c03f47b21c5a67d436a0e62ebf416e94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
To insert covariant checks, CFE was searching for covariance in
contravariant positions and _not_ for non-covariant
(=contravariant+invariant) positions of type parameters. This
let to the omission of needed checks when type parameteres were
used in invariant positions (in function type parameter bounds).
Closes#37476
Change-Id: Icb4a827e75aee1a679ef7175d36904bbfbf6aa0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108815
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
The objective of this CL is to allow the incremental compiler to track
which dill input libraries it actually used (in order to - in a modular
context - be able to ignore changes to dependencies we didn't really
use).
This is done by:
* Making the dill library builder lazy (and mark if it has been used).
* Making kernels class hierarchy record which classes it has been
asked questions about.
* Add special handling to redirecting factory constructors as they
bypass the fasta-builders and directly use the kernel ast.
Please note that:
* This has to be enabled, but kernels class hierarchy always records
which classes it was asked about (even if disabled,
or not running though the incremental compiler).
There might potentially be some overhead to this (though setting
a bool to true is probably comparably cheap - we did just do a
map lookup).
* This was designed to be used together with modules
(e.g. setModulesToLoadOnNextComputeDelta) - as used via for instance
api_unstable/bazel_worker.dart. It might not function the way you'd
expect in other circumstances.
* The incremental compiler (potentially) gives you the full kernel tree
despite not having marked all of those libraries as 'used'. If a
client use such libraries it is the clients responsibility to take
that into account when answering any questions about this
libraries/dill files was used.
* This feature works on the library level. In practice it is most likely
needed at the dill-filename level. A translation from library to
dill-filename is up to the client.
* This is a new feature, and we cannot promise that 100% of actually
used libraries are marked. If you find used but un-marked libraries
please report a bug.
Change-Id: I01d7ff95b9baac9550b77d8e09ea772d43173641
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107280
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This:
(1) Uses dartdevc and kernel_worker directly to build ddk artifacts.
(2) Generates an outline file instead of a full dill file for ddc_sdk.dill.
(3) Fixes source maps in the shipped sdk so that urls from dart_sdk.js.map
have correct relative paths to dart files in the sdk. This won't work with
webdev/build as that copies and serves dart_sdk.js, but it will now be
able to build the sdk directly.
Change-Id: I7b9470fe18cac9b4343c7c520fe6ffd7bd9246b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104842
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
CFE failed to replace an invalid AwaitExpression in a non-async context
with an InvalidExpression. The lead to untransformed (and thus unexpected)
await expressions crashing the hot reload.
Closes#37108
Change-Id: I4457925b20749d231cbf9dac80203ee9b381a312
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107501
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
If an abstract method overrides a concrete method, and the abstract one
is more specific, it's an error, unless there's a user-defined
noSuchMethod, effectively making the abstract method concrete.
Change-Id: I06ebe2de257ef6627529e6e97ca11b768c9647b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106084
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
The CL fixes how override-based inference works in the cases when the
type of a parameter in the overriding method is omitted, and the type
of this parameter in the overridden method contains a type parameter
of the class. Basically, the type should be substituted in this case.
Change-Id: I36d6c614d47e5cd68dc14eae1a2bbe4cd19d842b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104784
Reviewed-by: Aske Simon Christensen <askesc@google.com>
If both the getter and the setter are present in the superclass, the type should
be taken from the setter.
Change-Id: Ie0d84e45d15341151af4a688c508da0f1d7b522d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101988
Reviewed-by: Aske Simon Christensen <askesc@google.com>
In the upstream CL https://dart-review.googlesource.com/c/sdk/+/100580 the
'covariant' bit on parameters of class methods isn't propagated correctly in the
case of mixins. Effectively, if it's used in a member of the superclass of the
mixin application, it won't be propagated to the mixin application or its
subclasses. Consider the following:
```
class A {
void foo(covariant num x) {}
}
class B {
void foo(num x) {}
}
class C {
void foo(num x) {}
}
class D extends A with B implements C {
void foo(int x) {}
}
```
The program above doesn't have any errors, and overriding foo in D using int as
the type of the parameter is allowed, because D's superclass A declares the
parameter as 'covariant'. Without the changes from this CL, the code will
result in a compile-time error. With the change, the 'covariant' bit is
propagated correctly, and the program compiles.
An existing test already covers the described behavior: see class Mixed in
tests/language_2/covariant_override/tear_off_type_test.dart.
Change-Id: Ia508a224527c95f5ef04c1f1fb02614f8ff43714
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101284
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Before this CL we could both crash and add wrong metadata to "part"
nodes when a part defined other parts.
This CL fixes it by
a) Not resetting a counter so *every* part in a part will be out of
bounds when trying to reference it; and
b) Check if a part directive is in bounds and ignore it if it isn't
(an error should already have been issued).
Change-Id: I3d31f2577b2120df6461c9cc1002131dbee9dbbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106641
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@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>