Use the version from tools/experimental_features.yaml as the current
language version (as specified in kernel).
Use the "enabledIn" from tools/experimental_features.yaml to write out
the major and minor version for enabling features. This replaces the
hard-coding of when nnbd is enabled (in front-end).
Change-Id: I5b5dd7c2bb0c1a412ef1e660dfbe61e227193e1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138284
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Unlike other final fields, late final fields without initializers have a
corresponding implicit setter. Previously, front-end was setting
Field.hasImplicitSetter to false for late final fields.
As a result, ClassHierarchy.getDispatchTarget was not returning such
field as a dispatch target for a setter invocation and TFA was inferring
incorrect types for late final fields (as if all setters for late
final fields disappeared).
Change-Id: I8f55f7ec8afa38e8cc3f54f85bd66c0381ae6318
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137701
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
It's a part of internal cleanup of pkg/kernel and pkg/front_end. The
nullability modifier is reused whenever a type object is created as a
(potentially modified) copy of another type object.
Change-Id: I9d09a744281e33814289a4f4dd65c764a7905eff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125260
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This change does not enable much (because the backends do not support
non-function type aliases), but this change makes it possible to work
on this feature in dart2js code, without making the changes to the
front end and the changes to dart2js part of the same cl.
Change-Id: I0d8a27a0e87cf6908f914b2c10d97ef3d02ebec5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125961
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Since we use a unification strategy for function type type parameter
equality, we have to assume they can end up being the same. The
implementation of TypeParameterType.hashCode now reflects that.
Closes#39409
Change-Id: I5054b591253fb7d17208ffebdc5236a7100974de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125607
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This CL adds an option to the incremental compiler that enables an experiment
invalidation strategy that only rebuilds bodies for changed libraries (if possible).
As far as we know, for valid applications this should work fine, although,
applications with errors in them (or where the changed libraries have errors in them)
might not issue those errors correctly.
Known caveats:
- Doesn't work on dill library builders (aka if you load from dill we
still have to invalidate transitively).
- Only body-in-brace-changes --- cannot add new private members for
instance, nor changed fields.
- It doesn't track which bodies has changed so there's room for
improvement in regards to for instance mixin stuff where we bail
if a class from an invalidated file is used as a mixin.
- Offsets for methods, for instance, isn't updated
- Any errors issued at the outline stage won't be issued.
Change-Id: I6edf073ec47ea31429479ffe67e2e8b6d2cb80dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124980
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Change Expression.getStaticType to take a StaticTypeContext instead
of a TypeEnvironment.
The StaticTypeContext provides access to the TypeEnvironment and the
current 'this type' as well as determining the nullability state of the
enclosing library.
This change is needed to support nnbd types for getStaticType and also
serves as a step towards supporting caching during static type
computations to avoid repeated computations of the same (complex)
expressions.
Change-Id: Ied974dff7f6f7c3c8f262aa80c8dea5c674662f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124683
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
When the CFE compiles an application as a whole (reads in all source
code), the interface targets to members of mixin applications are the
original mixin classes.
When the CFE compiles an application modularly (dependencies are
supplied as kernel files), the interface targets to members of mixin
applications are the copied members in the mixin application classes.
This slight difference does not surface in any test failures. Yet if we
start running our AOT kernel pipeline, we will deduplicate the mixin
application classes. This leaves dangling references (with no target).
The C++ AOT compiler, `gen_snapshot`, will crash if it hits any of
those.
Issue https://github.com/dart-lang/sdk/issues/39375
Change-Id: I17a57370a87cfbdc174829c2e68ecdb7c4a9757e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124993
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Add a flag to the verifier that tells it to assume that full constant
evaluation has been performed. It will then complain about anything
that should not be there after constant evaluation.
Also fix two bugs exposed by the new checks:
- The constant transformer did not visit annotations on type parameters
in function nodes.
- The InstanceCreation constructor did not set the parent pointers of
its children.
Change-Id: Ieef865a51892918e524da973b0cbaf52ed467181
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123400
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
This serves two purposes:
1) It can aid in debugging to better know which object you have.
2) It paves the way for a future re-design of toString so toString never
leaks.
Change-Id: Ice32209b19b961b7e92de829d8bee0ddd8bd6e93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122140
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This CL also completes the renaming of "neither" into "undetermined" by
renaming kNeither value in the nullability enum in
runtime/vm/kernel_binary.h into kUndetermined.
Change-Id: Ia266bf1b35577212b696fb4a093340ee8e986256
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121989
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Used to separate the behaviour without the variance experiment flag
turned off and with the flag turned on. Allows for more specific error
descriptions and allows the backend to avoid emitting variance
annotations for legacy covariance and only when the experiment is
enabled, otherwise there is no way of knowing whether the variance is
user specified.
Change-Id: Ia3070a1358e9b0fef10a3ce5057df881b9659832
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121140
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>