Dart now has a "covariant" keyword that serves the same purpose.
Fixes#28797
Note that this is a breaking change, not to the analyzer API but to
the language semantics implemented by the analyzer; client code that
wants the "@checked" behavior will now have to use the "covariant"
keyword instead. Since the front end implementation of the type
system only supports the "covariant" keyword, the impact on user code
should be low; any user code that would be broken by this change is
already broken under the front end. Google internal code has already
been migrated to use "covariant".
Change-Id: Ida052bd5449d3ba703bacf98143bece650f53b53
Reviewed-on: https://dart-review.googlesource.com/c/88225
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
So, that type inference that updates staticInvokeType later, in
StaticTypeAnalyzer._inferGenericInvocationExpression() also implicitly
updates methodNameType. This fixes the new set of exceptions that we
saw right before holidays. I'm running them now, most are green,
no reds yet.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: I53030a1a62a2a669549a47680c6c0c98b4031383
Reviewed-on: https://dart-review.googlesource.com/c/88227
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
... and rename endExpressionStatement to handleExpressionStatement.
This is needed for the next step in NNBD.
Change-Id: Ibed51f15a4e2d93d2b16a50e4e22e912f22d2171
Reviewed-on: https://dart-review.googlesource.com/c/88301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
In future CLs, we'll switch from using the UnlinkedConst RPN
representation to the string representation. Making ExprBuilder.uc
private will help isolate the necessary changes to just one class.
Change-Id: I44c32c48d6275e3b4fd900a45a396876ed388ee2
Reviewed-on: https://dart-review.googlesource.com/c/88284
Auto-Submit: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This is preparatory work for #35418. The string representation is
produced, and tested via unit tests, but not yet used. In follow-up
CLs we will begin modifying the analyzer to make use of the string
representation, guarded by a flag at first to avoid incompatibilities
with older summary files. When it is safe to do so we'll hardcode the
flag and remove the old RPN representation.
Change-Id: Iab92ff742930f39761a9df6630f199359d76fcf6
Reviewed-on: https://dart-review.googlesource.com/c/88231
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Example Dart file:
```dart
import 'package:meta/meta.dart';
@immutable class Foo {}
class Mutable {
int a;
bool b;
}
class Bar = Mutable with Foo;
class Baz extends Foo {
int a;
bool b;
}
class Quux extends Mutable with Foo {}
@immutable class Mut extends Baz {
int c;
bool d;
}
```
Error messages now look like:
Analyzing a.dart...
hint • This class (or a class which this class inherits from) is marked as @immutable, but one or more of its instance fields are not final: Baz.a, Baz.b at a.dart:12:7 • must_be_immutable
hint • This class (or a class which this class inherits from) is marked as @immutable, but one or more of its instance fields are not final: Mutable.a, Mutable.b at a.dart:17:7 • must_be_immutable
hint • This class (or a class which this class inherits from) is marked as @immutable, but one or more of its instance fields are not final: Mut.c, Mut.d, Baz.a, Baz.b at a.dart:19:18 • must_be_immutable
3 hints found.
Bug: https://github.com/dart-lang/sdk/issues/29394
Change-Id: Ib7aba7a4eb3f0ad35e459990558ad1866d5dd7d8
Reviewed-on: https://dart-review.googlesource.com/c/87860
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
There are no linked library because LibraryContext does not add it
if FileState.exists is false. I'm not quite satisfied that we do this,
because everywhere else we pretend that any file exists, but possibly
with empty content. However we use absence of the linked library
as a signal that `LibraryElement.isSynthetic` should be set. So, we
would need to signal not existing library to resynthesizer in some
other way, or make changes in places where we use `isSynthetic` to
decide whether to report errors.
R=brianwilkerson@google.com, paulberry@google.com
Bug: https://github.com/dart-lang/sdk/issues/35438
Change-Id: I39ad7d173b85a2e0bc7333bb7bee9fad709e0dea
Reviewed-on: https://dart-review.googlesource.com/c/87603
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
... as part of adding NNBD as outlined in
https://github.com/dart-lang/language/issues/110
This CL updates the parser to recognize two specialized comments at the
beginning of a library of the form '//@NNBD' and '//@NNBD*' for use
by the analyzer to aid developers when converting their libraries
to be non-nullable by default.
In addition, the AstBuilder now populates the generated analyzer AST
with nullable type information.
Change-Id: I80d221dd138973aa32f05bde631245d9ac6ee10f
Reviewed-on: https://dart-review.googlesource.com/c/87540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This uncovered a bug in dev_compiler that was showing up at compile
time--it was defaulting the enableAsserts flag to null, causing a null
pointer exception during kernel constant evaluation.
Change-Id: I2c75ffdc494f8d768aa98d67ef8257a20e74b9cd
Reviewed-on: https://dart-review.googlesource.com/c/86982
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>