Commit Graph

10502 Commits

Author SHA1 Message Date
Konstantin Shcheglov d1d8730472 Don't use part-of library that does not have the part file.
Bug: https://github.com/dart-lang/sdk/issues/44840
Change-Id: I7e7353472e5deaa3f63c6f461f547149b04d1fb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182366
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 23:54:16 +00:00
Konstantin Shcheglov e1273e96e8 Support URI in PartOfDirective in ToSourceVisitor.
Change-Id: I8e0eb8d55de3c78ad7723946296010136634f000
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182364
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 22:16:44 +00:00
Konstantin Shcheglov b971bbd199 Issue 41023. Remove debug information added for tracking the issue.
Bug: https://github.com/dart-lang/sdk/issues/41023
Change-Id: Icfe10ac290e88c099115b587532dbcdae19d3641
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182363
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 22:06:44 +00:00
Konstantin Shcheglov 977f1717e1 Fix for null in ElementImpl.session when synthetic getter/setter.
Change-Id: Id32003c3644275210778667f07bb49baddbfbdc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182362
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 21:36:34 +00:00
Paul Berry c5a79f9a15 Analyzer: stop using NullSafetyUnderstandingFlag in why_not_promoted_test.dart.
The CL to add why_not_promoted_test.dart and the CL to remove
NullSafetyUnderstandingFlag landed around the same time, so we failed
to notice the conflict between them.  The fix is easy: since
NullSafetyUnderstandingFlag doesn't exist anymore (and isn't needed
anymore), we can just remove this use of it.

Fixes bot failures with the test
`pkg/analyzer/test/id_tests/why_not_promoted_test`.

Change-Id: Icec2d57d371229f103b42c5e25d49aab952adc1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182340
Auto-Submit: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 20:29:14 +00:00
Konstantin Shcheglov 4c6f5f7658 Remove NullSafetyUnderstandingFlag.
Bug: https://github.com/dart-lang/sdk/issues/40531

Change-Id: I197cfdf64c697a09bb9e0e3896f3ee5ac1967757
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168160
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 18:03:24 +00:00
Paul Berry cbd8a4582c Analyzer: Fix null safety migration error in experimental flag generation
It's possible for an entry in `tools/experimental_features.yaml` to
lack an `expired` line, so we need to represent it as a `bool?`.

Avoids a crash when running `dart
pkg/analyzer/tool/experiments/generate.dart`.

Change-Id: I8734ccb9e6c5e43754b0ef870b08c304cc1470ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-02 17:17:34 +00:00
Konstantin Shcheglov 74583b31ed Make looking for BUILD file substitutes in BazelWorkspace optional.
Disable it for DAS, we always have BUILD files when interactive analysis.

Change-Id: I095f74ad25698e7ec07ea94252ee287d29e6a52f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182122
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 17:03:14 +00:00
Konstantin Shcheglov 8cbef3bec1 Cache files analyzed in AnalysisDriver.
This is necessary to fix a (recent) performance regression in search.

Change-Id: Iefe06021e4ba1536827cba88f91bfba9df7734a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182161
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 17:02:24 +00:00
Paul Berry a42244f73b Flow analysis: begin tracking non-promotion reasons.
This CL implements the core flow analysis infrastructure for tracking
reasons why an expression was not promoted.  It supports the following
reasons:

- Expression was a property access
- Expression has been written to since it was promoted

I expect to add support for other non-promotion reasons in the future,
for example:

- `this` cannot be promoted
- Expression has been write captured
- Expression was a reference to a static field or top level variable

These non-promotion reasons are plumbed through to the CFE and
analyzer for the purpose of making errors easier for the user to
understand.  For example, given the following code:

  class C {
    int? i;
    f() {
      if (i == null) return;
      print(i.isEven);
    }
  }

The front end now prints:

  ../../tmp/test.dart:5:13: Error: Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
  Try accessing using ?. instead.
      print(i.isEven);
              ^^^^^^
  Context: 'i' refers to a property so it could not be promoted.

Much work still needs to be done to round out this feature, for example:

- Currently the analyzer only shows the new "why not promoted"
  messages when the "--verbose" flag is specified; this means the
  feature is unlikely to be noticed by users.

- Currently the analyzer doesn't show a "why not promoted" message
  when the non-promotion reason is that the expression is a property
  access.

- We need one or more web pages explaining non-promotion reasons in
  more detail so that the error messages can contain pointers to them.

- The analyzer and front end currently only show non-promotion reasons
  for expressions of the form `x.y` where `x` fails to be promoted to
  non-nullable.  There are many other scenarios that should be
  handled.

Change-Id: I0a12df74d0fc6274dfb3cb555abea81a75884231
Bug: https://github.com/dart-lang/sdk/issues/38773
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181741
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 16:15:34 +00:00
Sam Rawlins 237c84249b Remove unnecessary imports in analyzer
Change-Id: Ifb9a5c0a31cf3669febf2981b1d26b84f5b9d237
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180781
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-02 14:40:24 +00:00
Konstantin Shcheglov cd54e90c78 Require null safe version of package_config and watcher
R=brianwilkerson@google.com, pquitslund@google.com

Change-Id: I34809b0bb681a831486c078deaac8b291e620aa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182160
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 00:28:23 +00:00
Konstantin Shcheglov d129808d3e Extract FileState._getUnlinkedBytes
So that we can avoid some null checks.

Change-Id: I2f798589e0dbae6802cfde879dfb73978c211728
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-01 23:41:11 +00:00
Konstantin Shcheglov ef9aea6800 Update recordStaticType to receive non-nullable type.
Change-Id: Id7c6d4c3aa3da99b331965f9ad9b002b3dc12e29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-01 21:12:11 +00:00
Konstantin Shcheglov 0e4dab0b8b Attempt to fix StringSource on windows bot for dart_style
Ideally we should stop using it at all.

R=brianwilkerson@google.com

Change-Id: Ifd891518561806794af809fe6ee4c1dbc4a722d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-01 21:04:31 +00:00
Konstantin Shcheglov 9f986d2501 Migrate package:analyzer to null safety.
Change-Id: Iffe4370431587e46a141ddc72a86ceec29c163b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176486
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-02-01 18:56:04 +00:00
Sam Rawlins 2caa4689f1 Analyzer: Allow optional 1st and 2nd params in Future.catchError callback
Change-Id: I448c0e98ae6f86b14b773acb03b04e87c72cc79b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-01 15:49:58 +00:00
Jens Johansen 16a66c8902 [parser] Don't crash, try to recover from written out logical operators and and or
Fixes #44785

Change-Id: I4c7198ea1c223900a58039c032ee303d7da2c14f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181580
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-01 09:30:48 +00:00
Konstantin Shcheglov 4506981ce5 Issue 44815. Fix for '?.' operator in PropertyAccess and binary AST.
Bug: https://github.com/dart-lang/sdk/issues/44815
Change-Id: I9a15a2c13885bb8a9461191a4837a053ae08a34e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182002
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-01 02:06:08 +00:00
Paul Berry d35cb900ca Expose _flowAnalysis from ResolverVisitor.
This saves a lot of plumbing work in the analyzer, because it allows
the individual resolver components to access flow analysis via the
resolver field rather than needing to maintain their own field.  It
should be helpful in supporting the upcoming "why not promoted"
functionality (#38773), which will require flow analysis to be visible
to even more parts of the resolver.

Bug: https://github.com/dart-lang/sdk/issues/38773
Change-Id: Ibea0ec7e263461d6c512b3dad59f10622b2aac6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181661
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-28 23:00:05 +00:00
Konstantin Shcheglov 65f8699046 Fix for searching required named parameters, merge SearchTest.
Change-Id: Iae337b68507bb2ae26bb7d872ca1bba8df329e08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-28 22:57:55 +00:00
Brian Wilkerson e586c931f7 Improve the highlight range for body_might_complete_normally
Closes https://github.com/dart-lang/sdk/issues/44446

Change-Id: I895253b341f299553441e073efb7485ec086ee5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181640
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-01-28 19:24:55 +00:00
Sam Rawlins 0a66c39bbe Analyzer: Report incorrect parameters for Future.catchError onError handler.
Fixes https://github.com/dart-lang/sdk/issues/35825

This check ensures that the function type passed to Future.catchError's onError
handler either accepts exactly one positional argument (an Object), or exactly
two positional arguments (an Object and a StackTrace).

Change-Id: Ic0473f6f3032e64fa5df478b478bd97fad8dae5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180680
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-01-28 15:49:15 +00:00
Konstantin Shcheglov 17a78826b7 Index references to any ParameterElement(s), such as required named.
Also switch index tests to the latest language version, with
non-function type aliases feature.

Change-Id: Ia818bde5ec6b83f850336baff4eb48ee0e418d90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181540
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-28 06:34:50 +00:00
Konstantin Shcheglov 3c390c2909 Tweaks for NonConstantTypeArgumentTest.
Change-Id: I19596e8c337799ef3f11650946dd8c7cfec80002
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181462
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-28 06:34:10 +00:00
Brian Wilkerson 00edf6fd13 Mark newly published docs as being published
Change-Id: I5663eaf6a6df94d279f15ca42364e96054c04987
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180800
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-01-27 20:19:17 +00:00
Konstantin Shcheglov ab03a9cde5 Issue 43090. Catch parser exceptions in available declarations.
Bug: https://github.com/dart-lang/sdk/issues/43090
Change-Id: Ia4cd891842bfdc7ac0b6a7755a916032bccfa202
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181340
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-27 02:39:15 +00:00
Konstantin Shcheglov 934980be80 Issue 44780. Fix reporing accessing instance from static when enclosed in local variable.
Bug: https://github.com/dart-lang/sdk/issues/44780
Change-Id: Iec59d928161b68ecf77f95792bd6e9ac8ca0d462
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181305
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-27 00:03:45 +00:00
Daco Harkes bc5952d8e8 [analyzer/ffi] Stop non-const warnings on ..ref
Closes: https://github.com/dart-lang/sdk/issues/44782

TEST=pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart

Change-Id: I434b9e68fb07e37cad03b1418897ea2295f81fc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181204
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-01-26 23:12:00 +00:00
Konstantin Shcheglov 64a8d2a8b8 Fix for indexing constructor references in documentation comments.
Bug: https://github.com/Dart-Code/Dart-Code/issues/2816
Change-Id: I4515b6887f5d8bd93fc6ba59812c5a9ec14f0d3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-26 20:15:44 +00:00
Konstantin Shcheglov 2941757a9a Report NULLABLE_TYPE_IN_EXTENDS_CLAUSE for nullable type aliases.
Change-Id: I51b66f8707c42b2630ea6e92753fe7a839f864fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180941
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-25 22:58:27 +00:00
Sam Rawlins f78b2bcad9 Reland: Report on return types of Future.catchError function
The type of the `onError` parameter of Future<T>.catchError is just Function,
but the function can either have signature `FutureOr<T> Function(dynamic)` or
`FutureOr<T> Function(dynamic, StackTrace)`. This change adds checks for return
statements in a function literal passed to `onError`, and the return type of a
function-typed expression passed to `onError`.

We still need to check parameter types.

https://github.com/dart-lang/sdk/issues/35825

Change-Id: I806d9d30e595fb9d63ae669f3c30c428b60fdf4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180880
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-01-25 21:30:43 +00:00
Daco Harkes e8497a332e [analyzer/ffi] Fix null exceptions
The analyzer has not been migrated, so this is based on manual
inspecation of the API about what can be `null` for now.

Note with the analyzer from master (running in nnbd by default) this
file contains many nullable to non-null assignments. However, we cannot
migrate this file to nnbd yet because of the language version it's used
in.

Closes: https://github.com/dart-lang/sdk/issues/44763

Change-Id: If0432341e7fefb973b0229bcc325eeefed84f7cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180821
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-01-25 15:16:32 +00:00
Emmanuel Pellereau ba0159688e Revert "Analyzer: Report on return types of Future.catchError function"
This reverts commit d5ee021819.

Reason for revert:
Breaks google3: b/178222419

Original change's description:
> Analyzer: Report on return types of Future.catchError function
>
> The type of the `onError` parameter of Future<T>.catchError is just Function,
> but the function can either have signature `FutureOr<T> Function(dynamic)` or
> `FutureOr<T> Function(dynamic, StackTrace)`. This change adds checks for return
> statements in a function literal passed to `onError`, and the return type of a
> function-typed expression passed to `onError`.
>
> We still need to check parameter types.
>
> https://github.com/dart-lang/sdk/issues/35825
>
> Change-Id: I3a1d1c444e298c5816fcd1d4bc537f7b87fa3da1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176221
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

TBR=scheglov@google.com,brianwilkerson@google.com,srawlins@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I8ebbaac0a4b44293576809baa2dc2c3fdcf35379
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180822
Commit-Queue: David Morgan <davidmorgan@google.com>
Reviewed-by: David Morgan <davidmorgan@google.com>
2021-01-25 12:04:52 +00:00
pq 3001499c78 data driven sdk api fix support
Change-Id: I5b05044b505fa5936d8148515c61172e443dc129
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180721
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-01-24 15:41:48 +00:00
Konstantin Shcheglov 95cc07e37d Fix ContextBuilderImplTest on Windows.
TBR

R=brianwilkerson@google.com

Change-Id: I88c042ff53fa5ee6fc520cea07eaaf5160eae886
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180662
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-01-22 22:14:53 +00:00
Sam Rawlins d5ee021819 Analyzer: Report on return types of Future.catchError function
The type of the `onError` parameter of Future<T>.catchError is just Function,
but the function can either have signature `FutureOr<T> Function(dynamic)` or
`FutureOr<T> Function(dynamic, StackTrace)`. This change adds checks for return
statements in a function literal passed to `onError`, and the return type of a
function-typed expression passed to `onError`.

We still need to check parameter types.

https://github.com/dart-lang/sdk/issues/35825

Change-Id: I3a1d1c444e298c5816fcd1d4bc537f7b87fa3da1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176221
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-01-22 20:56:09 +00:00
Paul Berry d4fb6b320c Set BinaryExpression.staticInvokeType properly for extension overrides.
Fixes #43114.

Bug: https://github.com/dart-lang/sdk/issues/43114
Change-Id: Ib0adf67c5ac5189732960a5925d7cdbcff0c4102
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180441
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-22 20:53:24 +00:00
Konstantin Shcheglov aa03d4a8e0 Add AnalysisContext.sdkRoot
Change-Id: I5895b4bb9ba797c93b22f20ee1f2185066de9365
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180622
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-22 20:19:44 +00:00
Sam Rawlins f849384456 analyzer: Remove extra space in RETURN_WITHOUT_VALUE
Change-Id: Iba0d7f88b1640ab7c07c71ac529b18633834b0d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180601
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-01-22 18:15:23 +00:00
Konstantin Shcheglov 84f871bc8e Remove several usages of FunctionTypeAliasElement in analyzer.
Change-Id: I93009b2347d6f30d3ad7df20a2fadb4b4c419cf8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180501
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-22 17:22:03 +00:00
Daco Harkes d74b2f4672 [vm/ffi] Deprecate Pointer.elementAt and sizeOf generic calls
The analyzer and CFE now report a warning on calls to
`Pointer<T extends NativeType>.elementAt()` and
`sizeOf<T extends NativeType>()` where `T` is a generic.

Adapted from https://dart-review.googlesource.com/c/sdk/+/178200 to
only deprecate but not error out on generic calls.

Does not roll forward `package:ffi` to a version with the `Allocator`
but keeps the generic `sizeOf` invocation. This causes extra warnings
in the pkg/front_end testcases.

Issue: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/data_test.dart
TEST=tests/ffi/sizeof_test.dart
TEST=tests/ffi/structs_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I8f41c4dc04fc44e7e6c540ba87a3f41604130fe9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180560
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-22 13:58:09 +00:00
Daco Harkes f74c9d43d3 [vm/ffi] Deprecate Pointer<T extends Struct>.ref generic calls
The analyzer and CFE now report a warning on calls to
`Pointer<T extends Struct>.ref` and `Pointer<T extends Struct>.[]`
where `T` is a generic.

Adapted from https://dart-review.googlesource.com/c/sdk/+/180190 to
only deprecate but not error out on generic calls to `.ref` and `[]`.

Issue: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I81353089d59f093730d63792e9dbcd0b2ff0c432
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180365
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-22 13:58:09 +00:00
Daco Harkes c3b30df798 [vm/ffi] Deprecate empty Structs
The analyzer and CFE now report a warning on subclasses of `Struct`
which have no native fields.

Adapted from https://dart-review.googlesource.com/c/sdk/+/180189 to
only deprecate, but not disallow empty structs.

Rolls `package:ffi` forward to migrate `Utf8` and `Utf16` to `Opaque`
to prevent tests from failing on those generating warnings for empty
structs.

Issue: https://github.com/dart-lang/sdk/issues/43974

TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: Ia364e31da66cb195570c2e2b729d03dd261f28a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180361
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-22 13:58:09 +00:00
Konstantin Shcheglov cea28f1ac5 Support for AwaitExpression in binary summary format.
Bug: https://github.com/dart-lang/sdk/issues/44699
Change-Id: I174e015ff8378fafc1c528198df2157532cf393a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180460
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-21 23:15:16 +00:00
Paul Berry 4ee861b7d0 Flow analysis: Track additional assigned variables information.
We now track the following additional information:

- All local variable reads and read captures (previously we only
  tracked writes)

- For any conditional expression (`?:`) or if-test, the variables
  written in the "then" branch

- For any logical and expression (`&&`), the variables written in the
  right hand side of the expression

Tracking this information will allow us to implement legacy type
promotion as part of _fe_analyzer_shared, using the same API as flow
anaylsis, which will in turn allow a lot of front end and analyzer
code to be removed and simplified.

Change-Id: I01aaf64cefb989a4450c8e6d3a8373c1ca2b6dec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179980
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-21 19:48:22 +00:00
Konstantin Shcheglov 2be0ff80d9 Issue 43478. Implement update to least upper bound.
Bug: https://github.com/dart-lang/sdk/issues/43478
Change-Id: Ib0c249a17148a6b6bc04d10e32e158f8cee97bed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180122
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-01-21 18:37:50 +00:00
Konstantin Shcheglov 8258e38acd Add containsTypeParameter() helper.
Change-Id: Id1a7b22e0a0d5a1b5c3338ec0a216df49933af80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180241
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-01-21 04:24:03 +00:00
Daco Harkes 1fe4597638 Revert "[vm/ffi] Disallow empty structs"
Revert submission 177862

Reason for revert: breaks g3 without https://github.com/flutter/engine/pull/23808
Reverted Changes:
I50b3b4c31:[vm/ffi] Roll `package:ffi` to `Allocator` and `Op...
I3f5b08c08:[vm/ffi] Change `Pointer<T extends Struct>.ref` to...
I6141c193b:[vm/ffi] Disallow empty structs

Change-Id: Ibe9e8200dbdafe0ee684a6a0ea19e06214edf5e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180184
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-01-20 21:37:11 +00:00
Daco Harkes 49ec189fb3 Revert "[vm/ffi] Change Pointer<T extends Struct>.ref to use s..."
Revert submission 177862

Reason for revert: breaks g3 without https://github.com/flutter/engine/pull/23808
Reverted Changes:
I50b3b4c31:[vm/ffi] Roll `package:ffi` to `Allocator` and `Op...
I3f5b08c08:[vm/ffi] Change `Pointer<T extends Struct>.ref` to...
I6141c193b:[vm/ffi] Disallow empty structs

Change-Id: I1bfe4d70a5f7f35039b8a01d599d33542872574c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180183
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-01-20 21:37:11 +00:00