And updade flow analysis clients to use this interface, so that we
have no risk of accidentally trying to promote things that shouldn't
be promotable. (Previously we used VariableElement, which would have
allowed fields).
Fixes https://github.com/dart-lang/sdk/issues/38572.
Change-Id: I225d3adabea503ca7eb9042516cf95d5a257fec6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119162
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
TypeParameterElement caches its default type, as it gets it from the
resolved TypeParameter node. So, while DefaultTypesBuilder will get
to the node from which we got this default type, and will finish its
building from TypeBuilder to a normal DartType, it is too late. We
should make sure that we only cache already built types.
R=brianwilkerson@google.com
Bug: https://github.com/dart-lang/sdk/issues/38498
Change-Id: Ie3e3645efdf44a9e599655bec5a5e410c75c1a58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119166
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This fix is basically a revert of the first fix for for the same issue,
627e4c8cadFix#37708
Bug: 37708
Change-Id: Ic470b2663e7171fcac6a8de3d9e1276b7815a64b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118574
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Pass variance data to field in TypeParameter through the listeners.
ast_to_text will print variances for classes and mixins if specified.
Avoids serialization/deserialization (impl in future CL).
Change-Id: I298537604823710f0d30001f4cb5f1e81530959f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118464
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
So, we can stop using it internally, and don't tie up landing
breaking changes and other changes to internal code.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: I09f36fa5b48fb03b040023d8c96353a9100d6586
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118882
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Since some pedantic issues were individually enabled, this CL turns our
analysis_options files into something more like "pedantic lints,
except ...". Effectively, this _adds_ the following lint rules:
* avoid_empty_else
* avoid_relative_lib_imports
* avoid_shadowing_type_parameters
* avoid_types_as_parameter_names
* library_names
* library_prefixes
* null_closures
* prefer_contains
* recursive_getters
* type_init_formals
* unnecessary_null_in_if_null_operators
* unrelated_type_equality_checks
* use_rethrow_when_possible
It also documents (for some rules) how many violations certain rules have.
Change-Id: I79a2c101ae4d10215d3f232d9e511bf8e6c7faa4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118720
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This reverts commit acac9ab11b.
Reason for revert: breaks source_gen, see https://github.com/dart-lang/sdk/issues/38546
Original change's description:
> Issue 37608. Use instantiated FunctionType for tear-off(s).
>
> I was working of switching runtimeTypeMatch() to purely
> typeSystem.isSubtypeOf(), without working around dartbug.com/35993
> and dartbug.com/33441, but bots were failing. I think that was because
> of this issue with incorrect tear-off types. We have to fix it before
> switching to less generous TypeSystem.
>
> R=brianwilkerson@google.com, paulberry@google.com
>
> Bug: https://github.com/dart-lang/sdk/issues/37608
> Change-Id: I1f5dfc5e86553a352d72e772e791978772fe8fa4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118379
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
TBR=paulberry@google.com,scheglov@google.com,brianwilkerson@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: https://github.com/dart-lang/sdk/issues/37608
Change-Id: Icb6bf93f9b39d3af1d13e9b103afea5364b9169a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118646
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
We are still call it at one place, because instantiateToBounds()
currently requires a DartType.
Change-Id: Ie9551e113e0086a87d3ec8a1bb0d59aff94c72fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118373
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
New error message for multiple variances and will handle recovery from
more than one variance modifier before a parameter.
Change-Id: I63ed8a7f04dd664e20d72b632b40f723aa43020f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118621
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
With the experiment flag on, will properly parse the `in`/`out`/`inout`
keywords. Without it, will issue an error regarding the flag. First CL
for parsing, syntax support, no AST work yet.
Keywords only parse correctly for classes and mixins.
See test `variance_disabled_syntax_test.dart`.
Change-Id: I37d765804fa0752512abf52fa44456a173087ef0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117929
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
I was working of switching runtimeTypeMatch() to purely
typeSystem.isSubtypeOf(), without working around dartbug.com/35993
and dartbug.com/33441, but bots were failing. I think that was because
of this issue with incorrect tear-off types. We have to fix it before
switching to less generous TypeSystem.
R=brianwilkerson@google.com, paulberry@google.com
Bug: https://github.com/dart-lang/sdk/issues/37608
Change-Id: I1f5dfc5e86553a352d72e772e791978772fe8fa4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118379
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
We also now don't try to share parts of strict FunctionType(s).
So, I'm removing the corresponding tests.
If we decid that we need this, the correct place to do this is
the type algebra.
Change-Id: I4f7d9df892f8606af8f0403358e56d4a07bdd025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118321
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
There is still a couple of write in type_algebra, should be changed
together with using nullability prefixes there.
R=paulberry@google.com
Change-Id: I090eae3dbd709c8bc76da6038a940f12fd9726f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118106
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>