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>
When an explicitly defined type variable is used in an incorrect
variance position in a method (whether in the return or the
parameters), an error is emitted.
Change-Id: I7e49687579bb2ce6e293b052b657b98741cb04f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122740
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@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>