Commit Graph

8489 Commits

Author SHA1 Message Date
Konstantin Shcheglov abb6f993b5 Extract ToSourceVisitor into separate file.
Change-Id: I17362136af2501482cca642387549e85e5fa2413
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-28 19:12:23 +00:00
pq a8566798d3 roll back implicit setter/getter metadata “fix”
Change-Id: I605250abca46618ad277c368bd68d42990c6c5c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123322
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-10-28 18:46:35 +00:00
Konstantin Shcheglov c60daa3229 Use shared instance of LocalVariableInfo.
LocalVariableElement(s) and ParameterElement(s) are unique, and are not
equal across functions. So, we can use a single instance of
LocalVariableInfo. We don't need it for CompilationUnit though.

Actually, we don't need LocalVariableInfo in each FunctionBody, but
our API exposes isPotentiallyMutatedInClosure/Scope from FunctionBody.

Change-Id: I446101020efec7727c7aabd6dd3369563a926d33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-28 16:25:06 +00:00
Konstantin Shcheglov 919d292cee Compare nullabilitySuffix(s) in TypeParameterTypeImpl.==
Compare bounds in TypeParameterMember.==, not in the type.

Change-Id: Iaed8ca6d37847193e335279955647ff2bc540c62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-28 16:17:01 +00:00
Konstantin Shcheglov 6ae42758fb Remove ToSourceVisitor.
Change-Id: Ie9d7a401ac5cc830eeddbf51cd191c050253d377
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-28 15:58:41 +00:00
Brian Wilkerson df8876582c Include all variations of a message in diagnostic docs
We now have multiple messages for the same name (id) and all of the
messages should be included in the docs so that users aren't confused
when the message they see doesn't match what's documented.

Change-Id: I0f668ececae1e9852eff9db25f29a48b7414c4d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123141
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-10-28 15:55:31 +00:00
Konstantin Shcheglov 8a7ffc5b81 Make InterfaceTypeImpl.typeArguments final.
Change-Id: I51af8de355dd994005419ccfc593f3f4fbd988cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123064
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-28 15:47:27 +00:00
Konstantin Shcheglov 581b959423 Remove methods _typeOfExecutableElement().
Change-Id: I61ddceefe214176361727482e4044a59d656d581
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-28 15:40:02 +00:00
Konstantin Shcheglov c3e2158171 Remove CompilationUnitElementImpl.annotationMap
Change-Id: I4a53887c210b380ffdbd0b6bc0a9128781e8ad8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123063
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-28 15:39:21 +00:00
Konstantin Shcheglov 5a92c0e395 Remove FunctionElementImpl_forFunctionTypedParameter.
R=brianwilkerson@google.com

Change-Id: I9d76b16992d4ab00e96c50d3f52c3d4cf339edd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-28 15:20:11 +00:00
Paul Berry a9fb6b8812 Use TokenType.isIncrementOperator more often.
This is less error prone (and shorter) than checking separately for
PLUS_PLUS and MINUS_MINUS.

Change-Id: I1234d689620ba05dbd878f704a618d5e2e4dea84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123010
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-27 11:09:49 +00:00
Paul Berry 9f25d0e1d8 Flow analysis: don't necessarily clear promotions on assignment.
If the RHS of an assignment is a subtype of the current promoted type
(or one of the previously promoted types), any relevant promotions are
kept.

So for example:

  if (x is int) {
    x = x + 1; // Still an int!
    print(x.isEVen); // ok
  }

This required two significant changes:

- Clients must now tell the flow analysis engine the type of the RHS
  of the assignment.  This required some refactoring in the analyzer,
  because this information wasn't always easily available at the point
  where we were calling flow analysis.

- The flow analysis engine now has to keep track of a "chain" of the
  currently active promotions, so that it can potentially un-do some
  promotions but not others.  This meant that the algorithms for
  "join" and "restrict" had to be reworked.

In a future CL I'll add the ability for assignments to promote to
types that have been previously checked against ("types of interest"),
e.g.:

  if (x is! int) {
    x = 0; // x is now an int!
  }
  // x is now known to be an int because it's promoted in both branches

Change-Id: I63d6c9a2021b045d391b2d9c674e9a2e5f770e62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123003
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-26 20:38:28 +00:00
Paul Berry 93afae8d0c Flow analysis: fix AssignedVariablesVisitor treatment of for-each loops.
Change-Id: Icd05b63d1a92f2065de1c04583be9bb47c14bbd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122982
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-26 18:50:18 +00:00
Paul Berry 7c1fa846cd Refactor the logic for inferring for-each loop variable types.
Currently we only use this logic when the for-each loop declares its
own loop variable, and that loop variable doesn't have an explicit
type.  However, for NNBD, we'll need to use the same logic for when
the for-each loop doesn't declare its own loop variable, so that flow
analysis can see whether the implicit assignment to the loop variable
should un-do type promotions or not.  Since flow analysis integrates
via the ResolverVisitor, we need the inferred type to be accessible to
the ResolverVisitor.  So we create a new method
`StaticTypeAnalyzer.computeForEachElementType` to compute the type,
and call it from `ResolverVisitor`.

Change-Id: I544d72371a6c710297e467b9b37bd909490a7336
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-26 18:50:18 +00:00
Konstantin Shcheglov 31de45b6c0 Issue 38582. Fix for Set/Map disambiguation and NNBD.
Bug: https://github.com/dart-lang/sdk/issues/38582
Change-Id: I8573acd2f6736db8a6681df16790b42058d2bf4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123006
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-26 00:25:03 +00:00
Konstantin Shcheglov 12c5eaae27 Issue 39089. Don't consider postfix bang as setter context.
Bug: https://github.com/dart-lang/sdk/issues/39089
Change-Id: I8fcde32d054c2299c344abe0dee520025be776cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123007
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-25 23:43:07 +00:00
Konstantin Shcheglov 1c187adbad Issue 38583. Don't resolve type of this in extension to bounds.
Bug: https://github.com/dart-lang/sdk/issues/38583
Change-Id: I61ec7fa3ccd50909dae6ce16028d626c8d03be24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123021
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-25 23:42:59 +00:00
pq 1a611e1d72 validate nonVirtual overrides
Change-Id: I1077ffa17d5620b5af77872a5862012ce8274324
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122820
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-25 21:16:28 +00:00
Konstantin Shcheglov bad583a9fc Always provide nullability suffix to FunctionType constructor.
Bug: https://github.com/dart-lang/sdk/issues/39111
Change-Id: Id91a5c3f559446fbbcc02d6f9465780d287deb29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123020
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-25 18:53:46 +00:00
Konstantin Shcheglov a018f27470 Issue 38494. Report DEFAULT_LIST_CONSTRUCTOR_MISMATCH only for default List constructors.
Bug: https://github.com/dart-lang/sdk/issues/38494
Change-Id: I42657e8fa1c7a2615b9bd9536a4c0d4599976f3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123002
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-25 18:13:46 +00:00
Konstantin Shcheglov 70b1cedd87 Use NNBD subtyping rules.
https://github.com/dart-lang/language/blob/master/resources/type-system/subtyping.md#rules

This includes subtyping tests ported from CFE.

Performance is on par with the performance before this changes.
On package:flutter, when each isSubtypeOf() is executed 100 times,
timings are 35292 ms vs. 33838 ms spent on isSubtypeOf() itself
(not the whole analysis times). So, the difference is about 5%,
but because it is 100x, it should result in less than 0.05% of total
analysis time difference.

There are other optimizations that we can make in this area, though.
For example checking for `Object?` could be done using identical() to
avoid expensive megamorphic (I think) `isDartCoreObject`. Similarly
for checks for `Null` and `FutureOr`.

Google3 presubmit looks green.
https://test.corp.google.com/ui#id=OCL:276348418:BASE:276562990:1571960231050:ff94b8d8

Change-Id: I0b7e5baba82908e1123783c4a9494b1dfc74ea99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122682
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-25 17:50:06 +00:00
Brian Wilkerson d6efa87f1f Remove an unused variable
Change-Id: I42f129003cc71062d5defe1712bb94c469bd8062
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123000
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-10-25 17:45:16 +00:00
Konstantin Shcheglov 6700ed4ac5 Merge _FunctionTypeImplStrict into FunctionTypeImpl.
Change-Id: Ibc5f6c60d5064000ce94bf768125ed845c91ed32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122964
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-25 14:46:54 +00:00
Konstantin Shcheglov 01f1218c3c Remove ExecutableElementImpl.declaredReturnType
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ifed0717619aad611e2f6dbf2fadd10fc775cde0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122963
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-25 14:39:00 +00:00
Konstantin Shcheglov 80b0aaf9b8 Deprecate FunctionTypeAliasElement.instantiate2(), replace with instantiate().
Change-Id: Iead94143fb3d02536309e464039493981cf853d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122965
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-25 14:38:50 +00:00
Konstantin Shcheglov 2b23d8d327 Remove CircularTypeImpl.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I655076008267f16693c506051b2fe75f3b2ad06f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122966
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-25 14:30:54 +00:00
Konstantin Shcheglov c533ba029b Remove ClassElementImpl.version and flushing InterfaceTypeImpl.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I76d35b1138c095c5466d0e4596bef4635bc8528d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122849
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-25 14:30:46 +00:00
Paul Berry 0167f91012 Flow analysis: introduce ID tests for AssignedVariables.
This should make it easier to verify that the CFE implementation is
correct.

Note that this effort encountered a few bugs in the analyzer
implementation, which are marked with TODOs.  I will fix them in
follow-up CLs.

Change-Id: Ic164a1cf214b5730f848b17db2838c29d25b00d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122850
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-25 13:44:05 +00:00
Paul Berry 5ba6fb73ec Only use "stmt:" prefix when necessary to avoid ambiguity.
This makes the analyzer test behavior consistent with the CFE.

Change-Id: I5b7739632e08552aa3092a2b7ea6831ecad51ca1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122981
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-25 13:44:05 +00:00
Paul Berry b700114b1c Flow analysis: clarify the names of testing data structures.
These data structures are only used for testing (and are not even
created in normal production use).  Add "ForTesting" to their names so
that we are less likely to use them by accident.

Change-Id: Ic719d66089a692362957e257c9bbb2f632bfd174
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122980
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-25 09:42:24 +00:00
Konstantin Shcheglov 2662e16773 Remove 'prune' from analyzer types.
With summary2 we break typedef cycles during linking.

Change-Id: I2ebecc5d7eef1fe5750705777863bbaef70c7150
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-24 23:55:02 +00:00
Konstantin Shcheglov 690b151a30 Fix for getMember(forSuper) for Object.
R=brianwilkerson@google.com

Change-Id: I6d28c57104bb1cfda4ed079a2ed9bb6e9d1f3b3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122846
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-24 23:28:07 +00:00
Konstantin Shcheglov 9bf55768f3 Deprecate ParameterizedType.instantiate()
We keep instantiate() for FunctionType(s), because they, and only they,
have type parameters.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ibc67ed63542a92f49e4cbc7c89d4b6489be4e249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122727
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-10-24 20:42:07 +00:00
Brian Wilkerson 8db1005d64 Clean up after changes to ffi diagnostic changes
Remove markdown from diagnostic messages,
Format messages to fit in 80 lines,
Sort unsorted file,
Move diagnostic tests to the correct test classes,
Remove diagnostic that is no longer being generated.

Change-Id: I1dbd6a141a4ef31eb89d9ea5edfd17512cbb261a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122821
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-24 20:27:27 +00:00
Sam Rawlins 9cc57416be Change error node for MISSING_RETURN to be the name
Fixes #35607

Change-Id: I66b9921b0ede5370364b89a89fb19bf0df96ac97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122726
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-24 19:42:07 +00:00
Konstantin Shcheglov 83b6026f9f Deprecate DartType.substitute2()
Change-Id: I326f236391ab46539066eb58962efc501f4b53cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122724
Reviewed-by: Paul Berry <paulberry@google.com>
2019-10-24 19:40:49 +00:00
Konstantin Shcheglov 1d36ec5bad Don't report UNNECESSARY_TYPE_CHECK_TRUE for 'is Object' if NNBD.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/38643
Change-Id: If6b454e5b6b0b22783c6251199c007b3e8e7d363
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-24 19:39:18 +00:00
pq 6d9cff6df3 improve INVALID_NON_VIRTUAL_ANNOTATION message
Change-Id: I47e5c5a86b3c46f03d3537592aa8c43bdb14c4a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-10-24 18:24:27 +00:00
Konstantin Shcheglov 4da9baee8d Issue 38991. Build also local elements for individual statements outside of Block.
Bug: https://github.com/dart-lang/sdk/issues/38991
Change-Id: Ib720daec1ed246302392d035219a2cf4cfe81d90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122281
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-24 18:14:49 +00:00
Paul Berry 696a374b6f Flow analysis: properly handle the fact that ++ and -- are assignments.
Change-Id: Ie54fbf7c7c750457b2750de90c64e8ea32db15d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122730
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-24 17:57:27 +00:00
Paul Berry 8f5a45c22d Flow analysis: add support for ??=.
Change-Id: I8c99c42cf3a2560d7af3daf27ee316e22a2eb027
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122588
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-24 17:57:27 +00:00
Konstantin Shcheglov 8b1e73d15d Remove lazy FunctionTypeImpl.
Change-Id: I9dad79468560f1b4c4be793ba51105acf19f05d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122721
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-10-24 17:27:32 +00:00
Paul Berry b7911e4490 Flow analysis: add support for asserts.
Fixes #38761.

Change-Id: I6cc4adc0383cc56d99fa73ef75f728db0c56063b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122732
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-24 17:01:33 +00:00
Konstantin Shcheglov abcd948982 Remove MultiplyInheritedMethodElementImpl, MultiplyInheritedPropertyAccessorElementImpl.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I21c572a67cf68e82e95c1cd795a36b84475f06d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122723
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-24 16:54:55 +00:00
Konstantin Shcheglov 8107ba32b8 Remove FunctionElementImpl.shareParameters/shareTypeParameters.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I0dfba6bb7e54fe53d88882766f07c6466ed473c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122728
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-24 16:53:28 +00:00
Konstantin Shcheglov faa56aa01d Remove LibraryResynthesizerContext.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I29e419d3902f645ad8e0543aaef803d8b0395e0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122722
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-24 16:46:53 +00:00
Konstantin Shcheglov c4b2be85ac Remove VariableElementImpl.declaredType
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I1dd3cf1aaba46978494c62074124f62002d03bfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122741
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-24 16:45:24 +00:00
pq 0f2787c9f3 validation of @nonVirtual use
see: https://github.com/dart-lang/sdk/issues/34378

Change-Id: I0fe67c56bf7c08f211b6bf89d84c5495e32601a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122742
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-10-24 13:16:44 +00:00
Paul Berry 1bd6e20d76 Flow analysis: simplify the use of AssignedVariables.
Previously, the client was responsible for querying AssignedVariables
to find the variables assigned and captured during constructs like
loops, and passing that information into FlowAnalysis methods.  With
this CL, the client simply passes AssignedVariables into the
FlowAnalysis constructor, and the lookup happens automatically.

Change-Id: Ifbbf8ba8ea0d0f8a31d41244892c8c816eea56dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122731
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-24 13:00:50 +00:00
Paul Berry 23dda7c6bc Fix an analyzer corner case with compound assignments.
When analyzing an expression like `x += y`, where `x` may be type
promoted, we need to consider x's unpromoted type when determining
whether the result of the addition may be assigned to `x`.  Before
flow analysis, we didn't need to worry about this subtlety because the
appearance of `x` on the LHS of an assignment used to disqualify it
from type promotion within any scopes containing the assignment.

Change-Id: I17887c457c9d0ce17ce704884e04d93ca8a3e925
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122587
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-23 22:37:57 +00:00