Commit Graph

25510 Commits

Author SHA1 Message Date
Mike Fairhurst 48a9eb87ba [analyzer] Add hint for unnecessary ?.
Change-Id: I7a8532d353b1840332b7583a1884e6487a7656bf
Reviewed-on: https://dart-review.googlesource.com/c/92381
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-20 22:35:49 +00:00
Mike Fairhurst ccb2e2d293 [analyzer] Report dead code for x ?? y where x is non-null
Change-Id: I2946c5c9b8136151895a458b8ff44da66c96671a
Reviewed-on: https://dart-review.googlesource.com/c/92384
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-20 22:33:09 +00:00
Konstantin Shcheglov 004dd969b0 Remove mock_type.dart, it looks that it is not used.
R=brianwilkerson@google.com

Change-Id: Ic3e44afbc7be19536341781eb41bf725934d1aa3
Reviewed-on: https://dart-review.googlesource.com/c/93802
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-20 22:03:42 +00:00
Konstantin Shcheglov 266ce73e28 Remove CompletionSuggestion.elementUri, replaced with AvailableSuggestionSet.
R=brianwilkerson@google.com

Context: https://github.com/JetBrains/intellij-plugins/pull/633#issuecomment-465725310
Change-Id: I03a1b7e7ec7cc0a5b0797dc960b72ca314a32132
Reviewed-on: https://dart-review.googlesource.com/c/93745
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-20 21:34:18 +00:00
Paul Berry 7ebb0411f3 Rework DartFix listener interface to separate edits from suggestions.
Change-Id: Ieb10433f13d961ee0cfeac580104aed209ed52ea
Reviewed-on: https://dart-review.googlesource.com/c/93744
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-02-20 21:32:39 +00:00
Paul Berry 1c576b66bc Generalize FixCodeTask to handle arbitrary numbers of phases.
This is necessary because I will need to extend NonNullableFix to three phases.

Change-Id: Iccb9e0c52d01ff07413f7263ca415c27fe2a0857
Reviewed-on: https://dart-review.googlesource.com/c/93743
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-02-20 21:15:34 +00:00
Paul Berry fd377a4d6f Sort file non_nullable_fix.dart
Change-Id: Iee5cc6ae1c3c095be83dc9ed602f5eb1175659d8
Reviewed-on: https://dart-review.googlesource.com/c/93780
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-02-20 21:08:08 +00:00
Paul Berry 98af688787 Sort dartfix_listener.dart
Change-Id: Ib24ef59cad791dd47d4fe8374f42e2cb47570f8c
Reviewed-on: https://dart-review.googlesource.com/c/93742
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-02-20 21:07:28 +00:00
Paul Berry 7ebd02cdaa Work around for #35908.
As a temporary workaround, we ignore types when comparing default values for overrides.

See https://github.com/dart-lang/sdk/issues/35908 for a more detailed
explanation for why this is necessary.  Once summaries properly record
types of constant values, we will be able to revert this hack.

Change-Id: I04728231338274a088656a629e303c0f1745466d
Reviewed-on: https://dart-review.googlesource.com/c/93642
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-02-20 20:20:05 +00:00
Stephen Adams 0e453c637b [dart2js] Chain static assignments
Extend the logic for chaining field assignments to static variables.

Change-Id: Ia87d8ff3400d6f04257a546c7a1bb74775a3019e
Reviewed-on: https://dart-review.googlesource.com/c/93620
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-02-20 20:07:55 +00:00
danrubel 8b0dd94e11 Revise AstBuilder to generate the new set-or-map AST structure
This is the first of several CLs updating the parser and its listeners
to conform to the unified collection spec:
https://github.com/dart-lang/language/pull/200

Change-Id: I7750bc4b029f3963b2df77dab3630775ce921bba
Reviewed-on: https://dart-review.googlesource.com/c/93740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-02-20 19:49:45 +00:00
Konstantin Shcheglov 5e2529c82e Remove 'importUri' from CompletionSuggestion.
R=brianwilkerson@google.com

Change-Id: I1c06f7e6d84d5c2dd0eee7fa80f2e4bca3959513
Reviewed-on: https://dart-review.googlesource.com/c/93379
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-20 18:14:45 +00:00
Konstantin Shcheglov 1699562dfc Remove unused AbstractSingleUnitTest.
R=brianwilkerson@google.com

Change-Id: Ia705957e91214f6972089c81e38b441a9f711817
Reviewed-on: https://dart-review.googlesource.com/c/93378
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-20 18:14:05 +00:00
Johnni Winther 7edb7dddd8 Merge allocator analysis with collection of elided fields
- and rename to field analysis.

This prepares for recognizing effectively constant fields.

Change-Id: I1caa2e1a4f6d90fcd2562ec17d3093bff3a9b0d8
Reviewed-on: https://dart-review.googlesource.com/c/93427
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-02-20 16:03:24 +00:00
Aske Simon Christensen 6f8415245d [fasta] Transform set literals in initializers and default values.
The set literal desugaring was missing set literals in constructor
initializers and parameter default values. Furthermore, it assumed
that a constructor that contained a set literal had a body.

Fixes https://github.com/dart-lang/sdk/issues/35989

Change-Id: I42c77b96bbe751ee6f7c7ba7921e9b9df24c16e9
Reviewed-on: https://dart-review.googlesource.com/c/93660
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-02-20 15:38:54 +00:00
Daco Harkes 9b10476092 [kernel/ffi] fix library paths
Follow up of: https://dart-review.googlesource.com/c/sdk/+/93081

Change-Id: Ie4a71d0aa723fc8f9b9ed0d244a921445a81b394
Reviewed-on: https://dart-review.googlesource.com/c/93543
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-02-20 12:54:21 +00:00
Dmitry Stefantsov ef9592a9c7 [kernel] Add (de)serialization for ExpressionStatements
Change-Id: I388e8201086227a92adb2b7ac6622ea9def340eb
Reviewed-on: https://dart-review.googlesource.com/c/92563
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-02-20 12:40:21 +00:00
Dmitry Stefantsov 187d6ceb20 [kernel] Add statements to Kernel (de)serialization verifier
Change-Id: I560a3cebf2b9f116b02cd1803d9fde4c50a1bf41
Reviewed-on: https://dart-review.googlesource.com/c/92562
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-02-20 12:40:21 +00:00
Dmitry Stefantsov 395c0e4b98 [kernel] Add text (de)serialization for NamedTypes
Change-Id: I70aa3092a4a7b9c7f77b4e007a9d6fd602883ccf
Reviewed-on: https://dart-review.googlesource.com/c/92560
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-02-20 12:40:21 +00:00
Dmitry Stefantsov 14f5936468 [kernel] Simplify (de)serialization encoding for FunctionTypes
Change-Id: I1fde87601eb57d1e73fbc262b5b6be659fa2d3a0
Reviewed-on: https://dart-review.googlesource.com/c/92431
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-02-20 12:40:21 +00:00
Dmitry Stefantsov 5e3e633d5d [kernel] Add text (de)serialization for TypeParameterTypes
Change-Id: I6a50629b40fab061f3bade650b11499b505f9c3d
Reviewed-on: https://dart-review.googlesource.com/c/92429
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-02-20 12:40:21 +00:00
Dmitry Stefantsov 923cea6652 [kernel] Add Bind and Binder combinators
Change-Id: I24bb40faa516eb7093561c2348854771c9eac7d1
Reviewed-on: https://dart-review.googlesource.com/c/93407
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-02-20 12:40:21 +00:00
Dmitry Stefantsov c19af8cee9 [kernel] Cleanup code for (De)SerializationEnvironment
Change-Id: I751d13014f44bea99733eccdb9665ce4a50da8b2
Reviewed-on: https://dart-review.googlesource.com/c/93222
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-02-20 12:40:21 +00:00
Dmitry Stefantsov d60354b521 [kernel] Add binders and close terms as separate operations
Change-Id: I3e9372df5f37cad91d4609d052f05c94fdc54ab1
Reviewed-on: https://dart-review.googlesource.com/c/92428
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-02-20 12:40:21 +00:00
Dmitry Stefantsov a3736868c0 [kernel] Add text (de)serialization for type parameters
Change-Id: Id661da5ff16d9151852a563be08adc702c06b60a
Reviewed-on: https://dart-review.googlesource.com/c/92420
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-02-20 12:40:21 +00:00
Aske Simon Christensen d76293a75a [testing] Add shared options on the test.py commandline.
Specify extra shared options to the compiler and runtime via the
--shared-options= commandline option to test.py. For instance,
--shared-options=--enable-experiment=constant-update-2018 will enable
the front-end constant evaluation experiment for all tests run.

To avoid conflicts with tests explicitly enabling experiments, the
front-end parsing of experimental flags is changed to allow the same
flag to be mentioned several times, as long as the value is the same.
This matches the existing behavior of the analyzer.

Change-Id: I0c79e62b0b23ec7bc3824064dd27ef86b4451f9a
Reviewed-on: https://dart-review.googlesource.com/c/93501
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2019-02-20 11:11:21 +00:00
Johnni Winther 596e0aa645 Include FieldInitializer in allocator analysis
Change-Id: Id3ce8113816193408f704045c130e65fe65e6244
Reviewed-on: https://dart-review.googlesource.com/c/93424
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-02-20 10:53:01 +00:00
Konstantin Shcheglov 273856c6e3 Issue 3204. Support for local mixins as types.
However this is not what the issue is about.
But still a bug.

R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/3204
Change-Id: I743e1684f84844422bdfc8fcb30c2b3a051f4580
Reviewed-on: https://dart-review.googlesource.com/c/93376
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-20 03:28:01 +00:00
Konstantin Shcheglov 45cb49108f Issue 3204. Include mixin(s) into top-level declaration for import Quick Fix.
R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/3204
Change-Id: Ia80fca430c9cbe710ccaf74b97a1b025634b85b1
Reviewed-on: https://dart-review.googlesource.com/c/93641
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-20 03:05:21 +00:00
Konstantin Shcheglov 5722ca3126 Include defaultArgumentListString / defaultArgumentListTextRanges into AvailableSuggestion(s).
R=brianwilkerson@google.com

Change-Id: I114c3c53de5782fa72d033a39e0d96fa5134ea1c
Reviewed-on: https://dart-review.googlesource.com/c/93600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-20 00:15:21 +00:00
Konstantin Shcheglov 56356d426a Set 'displayUri' to IncludedSuggestionSet with file:// URIs.
R=brianwilkerson@google.com

Change-Id: I6d07e051839ba22c24d304dfa1e9bbee6517f234
Reviewed-on: https://dart-review.googlesource.com/c/93581
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-19 23:05:41 +00:00
Stephen Adams 43c4749f7e [dart2js] Turn on local aliases optimization
Change-Id: Ib916485202215545f8b1f68fdec7afd6008eeb46
Reviewed-on: https://dart-review.googlesource.com/c/93580
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2019-02-19 21:36:51 +00:00
Konstantin Shcheglov 1ed9a34513 Add defaultArgumentListString / defaultArgumentListTextRanges to Declaration.
R=brianwilkerson@google.com

Change-Id: I1ce920bf3373634674f12b6e710f702214335e83
Reviewed-on: https://dart-review.googlesource.com/c/93371
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-19 21:17:31 +00:00
Vijay Menon c338941801 [ddc] Elide continue to next switch case
Flutter uses continue labels (see
https://github.com/dart-lang/sdk/issues/29352), but only to the next
switch case - i.e., the fall through case.

The kernel backend already elides the continue here.  This does the
same for the analyzer backend.  This gets one co19 test passing on ddc
(was already passing on ddk).

Change-Id: Ifc085415e3d1735c1a534c0683a4c89289820ba0
Reviewed-on: https://dart-review.googlesource.com/c/93462
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2019-02-19 21:04:41 +00:00
Konstantin Shcheglov 3a0ded6d54 Use _ExecutableParameters to access named parameter names.
R=brianwilkerson@google.com

Change-Id: I801df17aca0ec466b3f60c6feffbf281744bc077
Reviewed-on: https://dart-review.googlesource.com/c/93486
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-19 19:58:51 +00:00
Konstantin Shcheglov 4c1025493a Enhance available suggestions protocol.
1. Rename includedSuggestionKinds -> includedElementKinds.

2. Add defaultArgumentListString and defaultArgumentListTextRanges.

R=brianwilkerson@google.com

Change-Id: I65c67252f6bad66c0c60a20315fd87affbeb653a
Reviewed-on: https://dart-review.googlesource.com/c/93560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-19 19:51:11 +00:00
Brian Wilkerson 28eb8604e3 Correctly handle invocations of top-level functions with an import prefix
Change-Id: I7e75dc79bf8104af974881bf9f8e3cd8de86b961
Reviewed-on: https://dart-review.googlesource.com/c/93370
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-02-19 17:50:31 +00:00
Konstantin Shcheglov 0ef30fb86e Protocol for IncludedSuggestionSet.displayUri.
R=brianwilkerson@google.com

Context: https://github.com/JetBrains/intellij-plugins/pull/633#issuecomment-464746341
Change-Id: I27339f4c9327adb761f2bb0ba326c318ce010383
Reviewed-on: https://dart-review.googlesource.com/c/93487
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-19 16:42:30 +00:00
Brian Wilkerson bcd2c7fb96 Fix ListLiteral construction and add comments
Change-Id: I52c925f3457ea039e08b59689f850cb1d1b8ab4a
Reviewed-on: https://dart-review.googlesource.com/c/93461
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-02-19 16:37:30 +00:00
Peter von der Ahé 48beacfd78 Remove Kernel-based mixin inference
Change-Id: Id3bb8f66164e55172f892c21a7761e6535cf6619
Reviewed-on: https://dart-review.googlesource.com/c/93426
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2019-02-19 11:24:05 +00:00
Peter von der Ahé e2b7f48333 Implement ClassHierarchyBuilder.getLegacyLeastUpperBound
Change-Id: Id946a8e49ef414e5d2f6439d15e6cb134c9ccb83
Reviewed-on: https://dart-review.googlesource.com/c/93425
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-02-19 11:24:05 +00:00
Peter von der Ahé d19d50f45f Support async in LUB test
Change-Id: I2b806125bd566809a7ca28a1de1bc47d91f40426
Reviewed-on: https://dart-review.googlesource.com/c/93413
Reviewed-by: Jens Johansen <jensj@google.com>
2019-02-19 11:24:05 +00:00
Peter von der Ahé 6a65f84a63 Implement longest path to Object
Change-Id: Ibf882536dde5a218f5fda085359d419e3ee0d831
Reviewed-on: https://dart-review.googlesource.com/c/93410
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-02-19 11:24:05 +00:00
Jens Johansen 0720888236 Temporarily ignore context of errors in expression_test
To get the same context on errors for expressions compiled against
something we just compiled and something we've loaded from dill we need
the dill to contain offsets on TypeParameters.
We cannot currently change the binary format to include it, so for now
ignore the context in expression_test.

Change-Id: Ifbcc4352650fc56974bf5a78d9eb615ecec34e39
Reviewed-on: https://dart-review.googlesource.com/c/92743
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-02-19 10:18:29 +00:00
Jens Johansen 6ccdffdb35 Test for expression compilation, type variables and initialize from dill
Prior to f4379435dd,
using a type variable in an expression used for
expression compilation, where the type variable came from a class
that was loaded from dill would fail because type variables wasn't set
up so the type variable didn't exist in scope.

This adds a test for it - the actual fix was landed in
f4379435dd.

Change-Id: Icccf796b96853ece5ea96d4f29d76bb92b59fc83
Reviewed-on: https://dart-review.googlesource.com/c/92564
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-02-19 10:11:24 +00:00
Jens Johansen 4bcc97a3d6 Don't run 'unbindCanonicalNames' in writeComponentToFile
Change-Id: Ic1c30d62ff558e5dec7e4c6a8e4fd8be85717728
Reviewed-on: https://dart-review.googlesource.com/c/93428
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-02-19 10:10:24 +00:00
Konstantin Shcheglov c9ef5be8d7 Issue 124524319. Improve getElementDeclaration to support invalid code with synthetic names.
R=brianwilkerson@google.com

Bug: https://buganizer.corp.google.com/issues/124524319
Change-Id: Ie80cc66d580aa1c84892df6f839480d6d0501210
Reviewed-on: https://dart-review.googlesource.com/c/93484
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-19 03:36:54 +00:00
Brian Wilkerson f9bb790f43 Add a fix to change invalid named argument names to an existing parameter name
Change-Id: Id03862e328d9399b0bd8d364d9448058aa1b6d43
Reviewed-on: https://dart-review.googlesource.com/c/93481
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-02-19 00:07:13 +00:00
Brian Wilkerson 1d1654592a Do not compute any imports for use on paste if import directives are being copied
Change-Id: I1e4aa232c2dac4acb6d9bc5c556fbaf619160cac
Reviewed-on: https://dart-review.googlesource.com/c/93483
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-02-18 20:21:33 +00:00
Brian Wilkerson 03932bb852 Convert more diagnostic tests to DriverResolutionTest
Change-Id: Ia3aaf54d2142300180b66c7fd18245fb492f8176
Reviewed-on: https://dart-review.googlesource.com/c/93480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-02-18 19:53:33 +00:00