Commit graph

36245 commits

Author SHA1 Message Date
Paul Berry 1b18e8f5ac Flow analysis: account for initializers of implicitly typed variables.
Previously, initializers of implicitly typed variables did not
contribute to the SSA tracking performed by flow analysis (see
https://github.com/dart-lang/language/issues/1785).  This change fixes
the bug, however the fix is conditioned on the "constructor tearoffs"
language feature to avoid compatibility issues (we don't want someone
to publish a package taking advantage of the fix, without realizing
that it makes their package unusable on older SDKs).

TEST=standard trybots
Bug: https://github.com/dart-lang/language/issues/1785
Change-Id: I1143440c7a9795b059e8f4b84e3f4125cd80732c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211306
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-08-27 15:01:15 +00:00
Paul Berry 1b4f067e0b Parser: Reduce the set of disambiguation tokens for resolving < ambiguities.
When the parser encounters a `<` after an expression, it must choose
whether to interpret it as a relational operator or a <typeArguments>
selector.  The disambiguation rule is: if the `<` and the tokens
following it *can* be parsed as <typeArguments>, and the token that
follows is a member of a privileged set of tokens, then it is treated
as a <typeArguments> selector; otherwise it is treated as a relational
operator.

This change reduces the privileged set of tokens to the following:

- the "continuation tokens" `(`, `.`, `==`, and `!=`
- the "stop tokens" `)`, `]`, `}`, `;`, `:`, and `,`

The names "continuation tokens" and "stop tokens" reflect the
rationale for choosing these tokens:

- Continuation tokens are tokens that we can reasonably imagine a
  programmer wanting to place after a type argument selector to
  *continue* the expression.  For example, `if (List<int> == T) ...`
  is allowed.

- Stop tokens are tokens that can't possibly follow a `>` that is a
  relational operator, because they *stop* the expression that's in
  progress.  For example, `var x = List<int>;` is allowed.

If a user wants to follow a <typeArguments> selector with a token
other than the ones above, they'll have to parenthesize the
expression.  So for example, if they want to do `List<int> + 1` (which
could be meaningful if an extension method defined `operator +` for
the type `Type`), they will have to use parentheses, and instead write
`(List<int>) + 1`.

Bug: https://github.com/dart-lang/language/issues/1806
Change-Id: I2816cdac24e55eac3cb3e9920e276404c1228d46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210941
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-08-27 14:56:16 +00:00
Paul Berry e1f0d03ec5 Flow analysis: rework analyzer/CFE handling of initialized variables.
Previously, the analyzer and CFE were responsible for two pieces of
logic that arguably should be in the shared flow analysis engine:

- Deciding whether or not it's necessary to tell flow analysis about
  initializer expressions.

- Deciding whether or not to promote the variable at the time of
  initialization (we do this when the variable is implicitly typed,
  and the initializer is a promoted type variable type).

It's better to just always tell flow analysis about the initializer
expression and let it decide what to do about it.

This paves the way for fixing
https://github.com/dart-lang/language/issues/1785 (which results from
initializer expressions sometimes being ignored when they shouldn't
be), by consolidating the broken logic into the flow_analysis library,
where it will be easy to unit test the fix.

Bug: https://github.com/dart-lang/language/issues/1785
Change-Id: Iec832e92995eb4f8d0c1fbd4e9be6c897e0917b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211180
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-08-27 14:53:06 +00:00
Ahmed Ashour 47b7fd4b75 Better loop for ADD_TYPE_ANNOTATION
Fixes #47015

Change-Id: I3b3c6e88e601c5da9bc60936f08007bdea52375d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211444
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-27 00:42:16 +00:00
Stephen Adams 5c582f82f0 [dart2js, js_runtime, js_dev_runtime] NaN-safe range checks.
`int` variables can attain NaN values because web int arithmetic
implemented by JavaScript numbers (doubles) is not closed under many
operations. It is possible get NaN using only addition:

    int a = 1, b = -1;
    while (a + a != a) { a += a; b += b; }
    int nan = a + b;

On the VM, a, b and nan are all zero.
On the web, a, b and nan are Infinity, -Infinity and NaN, respectively.

Since NaN can leak into int arithmetic, is it helpful if bounds checks
catch NaN indexes. NaN compares false in any comparison, so a test
of the form

   if (index < 0 || index >= a.length) throw ioore(a, index);

fails to detect a NaN value of `index`.
This is fixed by negating the comparisons, and applying De Morgan's law:

   if (!(index >= 0 && index < a.length)) throw ioore(a, index);

These changes have been applied to JSArray.[], JSArray.[]= and String.[]

For dart2js the change is a little more involved. Primitive indexing is
lowered to code with a HBoundsCheck check instruction. The code generated
for the instruction now uses, e.g. `!(i>=0)` instead of `i<0`.
This leads to a small code size regression.

There is no regression at -O4 since bounds checks are omitted at -O4.

At -O3 (where the regression is largest) the regression is
   0.01% for cm
   0.06% for flutter gallery -- array-heavy diff and layout
   0.21% for Meteor          -- array-heavy code
   0.30% for Box2DOctane     -- array-heavy code

I believe the regression can be largely alleviated by determining if
NaN is impossible at the index check, and if so, reverting to the smaller
code pattern. The analysis could be global, incorporating NaN into the
global abstract value domain, or a much simpler a local dataflow
analysis. Many indexes are loop driven and cannot reach infinity because
they are incremented by a small bump and eventually (even without a loop
guard) the index would stop growing when the increment falls below the
rounding error in O(2^53) iterations.


Change-Id: I23ab1eb779f1d0c9c6655e13d69f65d453db9284
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210321
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-08-27 00:37:56 +00:00
Konstantin Shcheglov d4c00fdfcc Issue 46968. Fix resolution when a function typed field formal parameter has type parameters.
Bug: https://github.com/dart-lang/sdk/issues/46968
Change-Id: I20ba948b26040e00635612f52af7cf7e51230695
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211465
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-26 21:08:59 +00:00
Sam Rawlins 59216c7949 analyzer: tearoff function reference w/ type args as part of method call
Fixes https://github.com/dart-lang/sdk/issues/47005

Change-Id: I0ea2dcd337030ef471123fd0e02b4398e1ace671
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211463
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-26 20:48:15 +00:00
Ahmed Ashour 88cd302eb0 ADD_TYPE_ANNOTATION to handle multiple variables with the same type
Fixes #46997

Change-Id: If64125dcd232472a49ffaa94b4bc8bdc5131d3cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211284
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-26 20:35:39 +00:00
Ahmed Ashour e30a55d74a CREATE_MISSING_OVERRIDES to create brackets if missing
Fixes #37903

Change-Id: I13ed4e1bf34bf7d5cfd0bdc78d6191c6964cc28a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-26 20:15:30 +00:00
Brian Wilkerson dd5b4cb05c Fix a concurrent modification exception
Fixes https://github.com/dart-lang/sdk/issues/47011

Change-Id: Ied724d32198831944a086de1bc045ef1e4b1909a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211462
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-26 20:14:49 +00:00
Konstantin Shcheglov 3dd14b8a3e Resolve combined code, remove generated from the result.
Change-Id: I66dc2fb505d4938b3d8b8ea8fb126f9a696af71f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211307
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-26 19:02:48 +00:00
Liam Appelbe 011068f824 [ VM / Service ] Add reportLines flag to getSourceReport RPC
Every known user of the coverage report just wants the line numbers. At
the moment they have to do a second RPC to get the Script object, so
they can translate the token positions into line numbers.

Slower test times with coverage are usually caused by the extra time it
takes to run the RPCs. So reporting the line number directly will halve
the time it takes to get coverage, for most users.

Bug: https://github.com/flutter/flutter/issues/86722
Change-Id: I7b8d436669713ebc7b7096790a02593b9cb94dda
TEST=CI
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211081
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-08-26 18:42:58 +00:00
Johnni Winther 888e41b5a2 [cfe] Add test for duplicate instantiation
Change-Id: I0ccd02622ab2ddc9f134011c7d29b0219e640116
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211442
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-08-26 17:39:38 +00:00
Johnni Winther 114ccb2c5c [cfe] Handle redirecting factory invocation in cloned expressions
Change-Id: I82f2c60da94017dae8dc5e258402d9ee64c9cdf8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211441
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-26 16:09:08 +00:00
Johnni Winther 0ac8ab3385 [cfe] Add more checkState assertions in BodyBuilder
Change-Id: Ibaa3c4494f0c7a06a259671105d5d9a1d9f168cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211282
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-08-26 15:17:38 +00:00
Brian Wilkerson 66f6684595 Add docs describing how to write a quick fix
Change-Id: Ie8e00fcdc860e5e4d1576ef719b4d44e9e9bf62f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211084
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-08-26 15:11:28 +00:00
Johnni Winther 7959f037bd [cfe] Add test for unused cyclic redirecting factories
Closes #46334

Change-Id: Iaec6a958e1850aacec21617be76062c200360f21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211261
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-26 13:49:28 +00:00
Johnni Winther 3be0f377a5 [cfe] Update parser test expectations after parser change
Change-Id: I207fc18ce8add110e405bdc407906d0925ae2eb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211440
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-26 13:42:28 +00:00
Johnni Winther 62b3f211e0 [cfe] Recognize tear off lowerings in check for misplaced type arguments
Change-Id: I75445a2c42f2a1b16599e5886a937558463383b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211263
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-26 13:21:08 +00:00
Johnni Winther ce4e7705f2 [cfe] Handle explicit instantiation in implicit creation syntax
Closes #46719
Closes #46887

Change-Id: I4ad0f1bb4ab847a44f749113c6446f62a474143c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211260
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-26 11:59:48 +00:00
Jens Johansen 72de10d938 [parser] Better error message for >>> when not enabled in some cases
https://github.com/dart-lang/sdk/issues/46886

Change-Id: Ib204d0c9a7116aaff0f0079be51d551c3f89316d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211003
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-08-26 10:58:20 +00:00
Jens Johansen a557444209 [CFE] Fix compilation error on submit hooks caused by running via comitted dart
Change-Id: I4ed16b16a6dff9ded6e4abcd05e777df483121d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211380
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-08-26 10:57:38 +00:00
Emmanuel Pellereau ba09864c94 Revert "[dart2js] Enable default constructor tear-off lowering"
This reverts commit 4ae44ffebb.

Reason for revert: breaks google (b/197789187).

Original change's description:
> [dart2js] Enable default constructor tear-off lowering
>
> Change-Id: I8e06be94cbcf3fcb28a348d38ce2542c20996cc7
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208924
> Commit-Queue: Stephen Adams <sra@google.com>
> Reviewed-by: Mayank Patke <fishythefish@google.com>

TBR=sra@google.com,fishythefish@google.com

Change-Id: I94086458abc52fad2419ebb64881ee064d647781
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211285
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
2021-08-26 05:24:31 +00:00
Stephen Adams 4ae44ffebb [dart2js] Enable default constructor tear-off lowering
Change-Id: I8e06be94cbcf3fcb28a348d38ce2542c20996cc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208924
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-08-25 23:21:22 +00:00
Stephen Adams 7731eea468 [dart2js] Instantiation.== and Instantiation.hashCode
Change-Id: Ic4e9c882b27a6490a913899d74141ff73c4aebab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210981
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-08-25 21:07:02 +00:00
Paul Berry d2b313227d Flow analysis: Pin down initialization behaviors before fixing #1785.
https://github.com/dart-lang/language/issues/1785 has a wide enough
impact that its fix will have to be bundled in with a language version
(i.e. future versions of Dart will have to reproduce the old buggy
behavior for code that's not opted in to the latest language version).
Therefore, we'll have to maintain tests of the behavior both before
and after the fix.  This CL is the first step in that process, adding
tests that validate the current (buggy) behavior.

Bug: https://github.com/dart-lang/language/issues/1785
Change-Id: I78f17999ac1cbc096a312ef977db24654e06a263
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210400
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-08-25 20:32:02 +00:00
Konstantin Shcheglov cf46f2848f Remove ResolverVisitor.shouldCloneAnnotations
Change-Id: Ib1c751b7f575b8038ef6e4a9c8bd013d1c9d730f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-25 18:15:02 +00:00
Ahmed Ashour 92026cec44 Add a fix for "EOL at end of file" lint.
Change-Id: I5540fad40869ec85d6b8a75df3d919781998d512
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-25 16:46:22 +00:00
pq 85156a691d linter 1.10.0
# 1.10.0

- improved regular expression parsing performance for common checks
  (`camel_case_types`, `file_names`, etc.)
- (internal) migrated to analyzer 2.1.0 APIs
- fixed false positive in `use_build_context_synchronously` in awaits inside
  anonymous functions
- fixed `overridden_fields` false positive w/ static fields
- fixed false positive in `avoid_null_checks_in_equality_operators` w/
  non-nullable params
- fixed false positive for deferred imports in `prefer_const_constructors`



See: https://github.com/dart-lang/linter/pull/2804

Change-Id: Ib069a6eeb0f9a8ca14c01acf21cad66831c26def
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-08-25 16:42:42 +00:00
Danny Tuppeny 2d8764a557 [dds] Don't automatically resume when attaching to processes via DAP
Change-Id: I8b0fd4b36a9dd229226046a74e031de005908417
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210920
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-08-25 16:37:52 +00:00
Sam Rawlins 1f06c7462b analyzer: Save one SimpleIdentifierResolver
Change-Id: I5c7076c98c92f9eef876634f9a389f92ffa42a15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-25 15:54:12 +00:00
Konstantin Shcheglov 965af148f3 Issue 46758. LATE_FINAL_FIELD_WITH_CONST_CONSTRUCTOR.
Does not pass https://dart-review.googlesource.com/c/sdk/+/211140
yet, because requires one more fix, not reporting
CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD for const redirect constructors.

Bug: https://github.com/dart-lang/sdk/issues/46985
Bug: https://github.com/dart-lang/sdk/issues/46758
Change-Id: If6289b595545216d2d4e247214c5176a6a9d4a31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209222
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-25 15:30:47 +00:00
Konstantin Shcheglov 8d5c80ce83 Remove scope elements, such as type parameters, after using when writing summaries.
Bug: https://github.com/dart-lang/sdk/issues/46981
Change-Id: I2f7ad246e376bffc9e67f548d979c211894668a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-25 15:30:44 +00:00
Johnni Winther 2a5c85e7cf [parser] Add useImplicitCreationExpression
This flag prepares for the removal of the special case of implicit
creation syntax, `foo<bar>.baz()`, which with constructor-tearoffs
doesn't have to be a creation expression. Since both the analyzer
and the CFE needs to support parsering without special casing
before it can be removed, the flag is added to ensure both
implementations will agree on what the future parser behavior will be.

The CL hard-wires the CFE use of the parser to a single constant value.

Change-Id: I04724f039d2e698f3cf67e8b0b56dfa7e96ed3b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211000
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2021-08-25 11:44:53 +00:00
Jens Johansen c0a9d571ce [kernel] Add 'dill_forensic' tool
Tool will try to extract useful information from invalid (e.g. partial
or wrong version) dill.
This is a first stab and could possibly be extended and improved in the
future.

Change-Id: Ib381794a3fe80036bb845800488fa0e1a7f04f83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211241
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-08-25 11:37:42 +00:00
Dmitry Stefantsov 1069cbe03c [cfe] Make undeclared return context undefined for async functions
Closes #46956.

Bug: https://github.com/dart-lang/sdk/issues/46956
Change-Id: I90b8e88864201fb522c5e626843e1dff262f591a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211023
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-08-25 09:56:05 +00:00
Johnni Winther b3af778a38 [cfe] Add UnresolvedKind for fine grained unresolved reporting
- including tests for issues 46719 and 46887

Change-Id: I601fcfcb956e059f502cbece29fb2a6a00f68846
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210464
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-08-25 09:51:54 +00:00
Stephen Adams 2f66afbfb4 [js_ast] dart format --fix
Formatted with `--fix`, followed by some small manual changes:

- Reflowed some comments to 80 columns.
- Replaced Map/Set constructor calls with {} literals.
- Removed type argument when on both sides of initialization.

Change-Id: I3f5d29dd7e144f96a02efa95db8b40bf63484442
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210940
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-08-25 03:08:21 +00:00
Konstantin Shcheglov 10125490a9 Report CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD for generative const constructors.
...and don't report for const factory redirecting constructors.

Bug: https://github.com/dart-lang/sdk/issues/46985
Change-Id: I4be654eaa923865de2372779f2ddf880ee98edcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211162
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-25 01:14:16 +00:00
Danny Tuppeny eff9280e55 [dds] Add support for vmServiceInfoFile to DAP attachRequest
Change-Id: Ibc3e4aef140cb2a2b061bb91b0328230ca70053d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210861
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-08-25 00:47:34 +00:00
Brian Wilkerson df964d1c1a Fix a bug in OpType that caused it to compute the wrong completion location
Looking atanges to the tests I wasn't sure whether this was a good change
to make, but the metrics improve for both locations as a result:

CompilationUnit_declaration                   64.159  |     58.277     -5.882
CompilationUnit_directive                   Infinity  |     88.826  -Infinity

The tests mostly cover the case where insertion is between the two, and in
those cases we might want a blend of the two because it's impossible to know
whether the user is adding a directive after the last directive or adding
a declarartion before the first declaration. But that's a topic for a
different CL.

Change-Id: I2b82209ab77796d0bc8b9fc4a7c0ab91293c3746
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211083
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-25 00:45:35 +00:00
Konstantin Shcheglov 4e122f6ef7 Declare ElementInformativeDataImpl.
Not used yet, mostly to get your opinion. If OK, will work on using it.

Change-Id: I772c6ab7547d5ca53a7e3949dc0874d7382a6439
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211042
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-25 00:32:24 +00:00
Ben Konyi c7fe9ada2f Reland "[ package:dds ] Add support for caching CPU samples based on UserTag"
This reverts commit ada4278fd5.

TEST=pkg/dds/test/get_cached_cpu_samples_test.dart

Change-Id: I771410c8647fc1eb721c5aeb325c7a595430435c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209120
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-08-25 00:04:04 +00:00
Ahmed Ashour b9459ffdd7 Better message for CREATE_MISSING_OVERRIDES
Fixes #46974

Change-Id: I9f628089803d880957d34c7d6063696d1aebdfcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211024
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-24 21:33:24 +00:00
Paul Berry 389740cff9 Flow analysis: Add ID test cases for #46937.
Bug: https://github.com/dart-lang/sdk/issues/46937
Change-Id: Ic1073a4514ab59468881b6b641bf179187103140
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211041
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-08-24 21:00:04 +00:00
Brian Wilkerson 0231a0841a Fix a bug in completion metrics
I found this while testing a change to the computation of the completion
location in `OpType`. The experiment started producing a completion
location that wasn't previously produced, and that's what led to it being
a key for one set of data but not in the other set of data.

Change-Id: I3938ae68ec61afbef98d9674c7d6377fa4120d4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-24 19:16:53 +00:00
Michael Thomsen 24c35304c7 Fix windows extension
TEST=Not applicable, fixing existing test

Change-Id: Ie39b7d71fdd1260471f44d98b0f75fe2d5a39153
Bug: https://github.com/dart-lang/sdk/issues/46970
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211060
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-08-24 18:01:23 +00:00
Konstantin Shcheglov 66b3b1a6c9 Issue 46937. Fix null shorting for MethodInvocation rewrite to FunctionExpressionInvocation.
Bug: https://github.com/dart-lang/sdk/issues/46937
Change-Id: Ifae85d5d1e7f671d99c217eb1d469022952704f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210943
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-24 15:56:43 +00:00
Johnni Winther ae4543fcb9 [cfe] Report all compile-time errors found during constant evaluation
Closes #46925

Change-Id: I81e97cae05c39c24b24dae82a222f857d4730ac7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210465
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-24 11:42:53 +00:00
Johnni Winther b54269e255 [cfe] Updates cf. equivalence visitors comments
Change-Id: Ib5990cf1434ce07019e9602150df66b359476095
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210863
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-24 10:37:49 +00:00