Commit Graph

25510 Commits

Author SHA1 Message Date
Danny Tuppeny c76fa45178 Add an analysis server diagnostics page for LSP capabilities and completions
Change-Id: I97fff735dddf24da4da4769309198f82fba66578
Reviewed-on: https://dart-review.googlesource.com/c/88964
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-10 15:15:40 +00:00
Danny Tuppeny 4a80990758 Implement LSP textDocument/documentHighlight
Change-Id: Iaa63791192e274a7ef8f2f4095e2984b27d95e05
Reviewed-on: https://dart-review.googlesource.com/c/88962
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-10 15:02:11 +00:00
Danny Tuppeny 44449e29d2 Add a custom toJson snippet for LSP ResponseMessage for null handling
This adds some custom code for serialising ResponseMessage to ensure that only one of result or error are ever specified, as required by JSON RPC.

Change-Id: I2736b83755553a906264b1e5251d1a535dc289fb
Reviewed-on: https://dart-review.googlesource.com/c/88953
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-10 14:46:30 +00:00
Danny Tuppeny 7e0d65706f Include null in allowed types for any and prefer null to omitting values if allowed
Without this, some requests that don't return values (like shutdown) would omit the `result` field from the response and this wasn't strictly correct (and caused an issue in testing with the VIM plugin).

Change-Id: Id961135d326b997aea69e29d9d2a4a2c310fa60c
Reviewed-on: https://dart-review.googlesource.com/c/88839
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-10 14:46:30 +00:00
Dmitry Stefantsov 59b252fa0a [kernel] Add text serializer/deserializer for VariableGet
Change-Id: I884190dffbca5eb5181f21bc12972b375e31de65
Reviewed-on: https://dart-review.googlesource.com/c/88724
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-01-10 14:20:01 +00:00
Jens Johansen e0ede8791f Fasta: Set fileEndOffset on Fields
Bug: #34742
Change-Id: Ia20acd0f30cbc64db875e756e1be7e053b9abf9b
Reviewed-on: https://dart-review.googlesource.com/c/88951
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-01-10 11:39:57 +00:00
Jens Johansen 705701951a Small cleanup in incremental compiler
Change-Id: I4ea16c95e6406b7bea73669d159c83c4c23b9802
Reviewed-on: https://dart-review.googlesource.com/c/88700
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-01-10 10:14:11 +00:00
Jens Johansen 05673b80fc Suggest uploading dill file when failing to initialize from dill
Change-Id: I5cbc9ef08581206035b6af3a4fa71d1b6b0bca98
Reviewed-on: https://dart-review.googlesource.com/c/88572
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-01-10 09:41:21 +00:00
Johnni Winther d00f1e7e8e Introduce kernel based impact builder
This is a step towards computing impact modularly without the need for a K-model.

Change-Id: Ie94ff7bc73b409acc99abe58b74502541ae5218f
Reviewed-on: https://dart-review.googlesource.com/c/88824
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-01-10 08:15:37 +00:00
Konstantin Shcheglov 0109e39ca4 Report INVALID_ASSIGNMENT for prefix/postfix increment decrement when the result is not assignable to the operand.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I83a732c039c1c83599c068a1944c5dd1040c3fd5
Reviewed-on: https://dart-review.googlesource.com/c/88880
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-10 05:51:15 +00:00
Peter von der Ahé e7495724b9 Remove TypeEnvironment.hierarchy
Change-Id: Ia32e2c0beb504e38f8dcb9bae33f4ee9f0e7daca
Reviewed-on: https://dart-review.googlesource.com/c/88825
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2019-01-10 05:21:24 +00:00
Peter von der Ahé 8e5ad9b3bd Prepare the VM for removing TypeEnvironment.hierarchy
Validating the class hierarchy requires subtype tests. Previously,
Fasta has worked around this by computing the hierarchy twice, as
well as visiting the hierarchy several times. In order to improve
performance of modular compilation, we're working on changing this.

To enable creating a TypeEnvironment without a hierarchy, we're
removing the field from the API.

Change-Id: I7c9f88d5c6495aaa8223eaeff7d2dfd5669e9e95
Reviewed-on: https://dart-review.googlesource.com/c/88823
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-10 05:21:24 +00:00
Peter von der Ahé 7ac495e02a Prepare DDC for removing TypeEnvironment.hierarchy
Validating the class hierarchy requires subtype tests. Previously,
Fasta has worked around this by computing the hierarchy twice, as
well as visiting the hierarchy several times. In order to improve
performance of modular compilation, we're working on changing this.

To enable creating a TypeEnvironment without a hierarchy, we're
removing the field from the API.

Change-Id: If1aa10598012e53455b92a63ebae12dbae316fc7
Reviewed-on: https://dart-review.googlesource.com/c/88822
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2019-01-10 05:21:24 +00:00
Mike Fairhurst ca9ea997bd Fix old treatment of {}, enable set literals tests
Change-Id: Iec319cb735a3747e64561f3865cce2f08fb2be0f
Reviewed-on: https://dart-review.googlesource.com/c/88601
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-01-10 01:38:34 +00:00
Stephen Adams 651d19cdaa Ignore --fast-startup flag, assume true
Change-Id: I7a41160bf7f5bb403177b19613de2889e0fa2b44
Reviewed-on: https://dart-review.googlesource.com/c/87424
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-01-09 21:22:57 +00:00
Brian Wilkerson aeb7fccd5b Fix plugin start up to work with OverlayResourceProvider
Change-Id: I9444f6787b9a549f112b997a6173abf12e6b110a
Reviewed-on: https://dart-review.googlesource.com/c/88860
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-01-09 20:10:31 +00:00
Danny Tuppeny 36b5fe0c7a Track how many analysis server requests had latency info
This makes the latency numbers more accurate if they're not available for all requests and also doesn't show them if no requests had latency info (rather than showing average of 0ms).

Change-Id: I6db5543a782025a8133077b33f1228cce952b387
Reviewed-on: https://dart-review.googlesource.com/c/88802
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-09 17:41:49 +00:00
Danny Tuppeny bf13ac85c4 Ensure LSP server clears diagnostics for removed files/analysis roots
Change-Id: I5eaa4141da499c5193253440e6913a0eb92ed533
Reviewed-on: https://dart-review.googlesource.com/c/88836
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-09 16:17:12 +00:00
Danny Tuppeny 54fffe4cca Add support for LSP workspace/didChangeWorkspaceFolders
Change-Id: I55401d0abf65979fcd446b2ba1e8d9b6c09a42fc
Reviewed-on: https://dart-review.googlesource.com/c/88831
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-09 16:04:12 +00:00
Danny Tuppeny e7b783ba5d Fix bug with deprecated rootPath + add tests
Change-Id: I53d0a9b9a367839cc4ecf463017463f343947dfc
Reviewed-on: https://dart-review.googlesource.com/c/88826
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-09 16:04:12 +00:00
Danny Tuppeny ad300b904d Improve handling of server-specific analysis diagnostics pages
Change-Id: I0c133860d438ee848203a537eceb520595532a2c
Reviewed-on: https://dart-review.googlesource.com/c/88804
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-09 16:04:12 +00:00
Danny Tuppeny 1d096d8499 Enable the analyzer Diagnostics server for LSP
Change-Id: I3a555c301e8c09b1d8af8f952f9f65102961d3b7
Reviewed-on: https://dart-review.googlesource.com/c/88801
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-09 16:04:12 +00:00
Peter von der Ahé a1250467fe Move member conflict detection to own method
Change-Id: I73ea21e502b5669c51fb32d0c44474938135e4c5
Reviewed-on: https://dart-review.googlesource.com/c/88716
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-01-09 13:46:25 +00:00
Aske Simon Christensen 0f1b9439b5 Use 'no-' prefix to disable an experiment.
Change-Id: I597a98802f6900d57ed4583c35b20790738e2f3a
Reviewed-on: https://dart-review.googlesource.com/c/88712
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-01-09 11:44:48 +00:00
Peter von der Ahé de85d1661a Implement DillClass.supertype
Change-Id: I58c048a6595a2b65a7f2c239ae2bc1e6d8aab2a4
Reviewed-on: https://dart-review.googlesource.com/c/88715
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2019-01-09 11:33:16 +00:00
Johnni Winther 2bc015b03a Remove dependency on TypeEnvironment.hierarchy
Change-Id: Ibc675aa37bf1d5f90640b41471d094025ae3da86
Reviewed-on: https://dart-review.googlesource.com/c/88805
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-01-09 11:21:36 +00:00
Peter von der Ahé 7ba199794d Save transient state
Change-Id: I1c2405b1237b6017a92b789452671938e0c25705
Reviewed-on: https://dart-review.googlesource.com/c/88448
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2019-01-09 10:48:06 +00:00
Peter von der Ahé 2bb2f5e834 Simplify ClassHierarchyBuilder.getNode
Change-Id: I2ca5197f6f69cf92641493ec865ccfe0bc716a15
Reviewed-on: https://dart-review.googlesource.com/c/88324
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-01-09 10:48:06 +00:00
Peter von der Ahé 34afa499a1 Merge interfaces only when necessary
Change-Id: I3d6f709df3e262447150abd84c30ef5a58a7a1d8
Reviewed-on: https://dart-review.googlesource.com/c/88323
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-01-09 10:48:06 +00:00
Peter von der Ahé 1dc920e0d7 Change names to reflect merge isn't used only for superclasses
Change-Id: I06a6fb3272e394ba2c7915f457c4c3ebf7d21d07
Reviewed-on: https://dart-review.googlesource.com/c/87966
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-01-09 10:48:06 +00:00
Peter von der Ahé 50ea6344f5 Use TypeEnvironment.getTypeAsInstanceOf instead of ClassHierarchy
Change-Id: I1682baeb336b8be3cb6c5874715ef8ba730561e0
Reviewed-on: https://dart-review.googlesource.com/c/88803
Commit-Queue: Peter von der Ahé <ahe@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Auto-Submit: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-01-09 10:08:03 +00:00
Kevin Millikin a7b23e1cb5 [Kernel] Add text serializers for some invocations
Add serializers for instance getters, setters, and methods and for
super getters, setters, and methods.  This requires also serializing
Arguments.

Change-Id: I36d36892bf896cd12b48f9e77395c0584daf47f1
Reviewed-on: https://dart-review.googlesource.com/c/88710
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2019-01-09 09:43:31 +00:00
Peter von der Ahé e7c808f910 Remove unused methods
Change-Id: I782700f972b846ec0d86b671c0c9b097ca73495d
Reviewed-on: https://dart-review.googlesource.com/c/88800
Commit-Queue: Peter von der Ahé <ahe@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Auto-Submit: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-01-09 09:40:51 +00:00
Johnni Winther cc4da96fb5 Decouple runtime type analysis from the K-world
Change-Id: I56730796de4117b6500e22b86cf3c5d6b047646c
Reviewed-on: https://dart-review.googlesource.com/c/88714
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-01-09 08:57:16 +00:00
Konstantin Shcheglov d09c1265e9 Issue 35467. Move ast_type_matchers/element_type_matchers into test/util/.
R=brianwilkerson@google.com, paulberry@google.com

Fixes https://github.com/dart-lang/sdk/issues/35467
Change-Id: I2aab476e2e88f5bdbf5e62a2104ff7d271a73209
Reviewed-on: https://dart-review.googlesource.com/c/88780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-01-09 04:46:39 +00:00
Konstantin Shcheglov 6680438415 Parse AnalysisOptionsImpl.enabledExperiments into experimentStatus.
So, we don't need to parse everywhere we need to check the status.

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

Change-Id: I4c120d0d8baf46fc9cd981c6a1f10ffe27a2f2de
Reviewed-on: https://dart-review.googlesource.com/c/88753
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-01-09 04:46:19 +00:00
Mike Fairhurst 5f59e42f9c Remove unused import
Change-Id: I446ffc1a7b4575f266274acffea75c88e2128d68
Reviewed-on: https://dart-review.googlesource.com/c/88751
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-01-09 01:45:40 +00:00
Stephen Adams ea6d343bae js_runtime: Improve hashCode for double values
Change-Id: Ibe97c130eb6658fadec1010dd9ff3292488ffc1d
Reviewed-on: https://dart-review.googlesource.com/c/88760
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-01-09 00:45:50 +00:00
lambdabaa b767744cfc Add optional elementUri field to CompletionSuggestion types in analysis server protocol
This will enable clients such as IntelliJ to display the package which code
completions are being offered from in addition to the keyword or identifier
that they're already getting from analysis server.

R=brianwilkerson@google.com

Change-Id: I30311451ad56b4eddbe73da20641ee0d14849293
Reviewed-on: https://dart-review.googlesource.com/c/88744
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Ari Aye <ariaye@google.com>
2019-01-09 00:13:39 +00:00
Konstantin Shcheglov 303b3a96a7 Use ExperimentStatus field in summary / resynthesize tests.
Also, use _parseText() that calls Parser directly, without PARSED_UNIT
from tasks.

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

Change-Id: I75e4ac5cfaafd7072b3c656310eafec2b3bef2de
Reviewed-on: https://dart-review.googlesource.com/c/88743
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-01-08 21:23:56 +00:00
Konstantin Shcheglov 52a159de5c Change AnalysisContext.analysisOptions setter to just remembering the AnalysisOptions object.
There was a bug with not copying enabledExperiments.

We don't do such defensive copying for other objects.

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

Change-Id: I4508b8101d9a912e1645932a3f9c1855f71969c4
Reviewed-on: https://dart-review.googlesource.com/c/88740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-01-08 21:22:12 +00:00
Brian Wilkerson e9eb4842ea Remove the unused hint code INVALID_ASSIGNMENT
Change-Id: I4b3aff6b53dcfb5d5f00c49992050e08e5b52002
Reviewed-on: https://dart-review.googlesource.com/c/88641
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-01-08 19:15:47 +00:00
Jenny Messerly 253b0cc1e3 [dartdevc] improve cast failoure error message
The new message should be a bit more understandable. Inspired by the
suggestion in #35480.

Change-Id: I1e20adf5a13191705b28121dbeaf323682e6d324
Reviewed-on: https://dart-review.googlesource.com/c/88300
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2019-01-08 18:46:16 +00:00
Brian Wilkerson 2ca417aff1 Initial support for recording nullability in types
Change-Id: I1938517ab88e9c868a04d0490f4a336bd1a126e4
Reviewed-on: https://dart-review.googlesource.com/c/88433
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-01-08 17:53:16 +00:00
Danny Tuppeny f54ac41ce1 Ensure LSP server advertises it has QuickFixes
Also ensure we only return a bool for code action capabilities if the client doesn't support code action literals.

Change-Id: I277fc406ecdee6b0ee1c284f283cd3cb64fb5bdb
Reviewed-on: https://dart-review.googlesource.com/c/88721
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-08 17:22:21 +00:00
Sam Rawlins 9dbb6fb113 Add a Hint enforcing contract of @literal
Example code:

```dart
import 'package:meta/meta.dart';

class A {
  @literal
  const A();

  @literal
  const A.named();
}

var a = A();
var b = const A();
const c = A();
var d = new A();

var e = new A.named();
```

Produces:

Analyzing b.dart...
  hint • This instance creation must be 'const', because the A constructor is marked as '@literal' at b.dart:11:9 • non_const_call_to_literal_constructor
  hint • This instance creation must be 'const', because the A constructor is marked as '@literal' at b.dart:14:9 • non_const_call_to_literal_constructor
  hint • This instance creation must be 'const', because the A.named constructor is marked as '@literal' at b.dart:16:9 • non_const_call_to_literal_constructor
3 hints found.

Bug: https://github.com/dart-lang/sdk/issues/34259
Change-Id: Iba10e5e0a0b2d0f7e99556cd6c201cea229ad675
Reviewed-on: https://dart-review.googlesource.com/c/88422
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-01-08 17:20:05 +00:00
danrubel 2cb346bd0c Add support for parsing complex nullable types
Change-Id: I38a59f96e299387b7266e46082d876105eb60f1e
Reviewed-on: https://dart-review.googlesource.com/c/88640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-01-08 15:52:54 +00:00
Danny Tuppeny 1ec1a8b46e Update LSP status doc
Change-Id: I8143fb3adae5917cda8ed03088c1187f487c15a7
Reviewed-on: https://dart-review.googlesource.com/c/88720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-01-08 15:26:05 +00:00
Kevin Moore 16f7f421df pkg:kernel - Fix three bugs identified by lints
Change-Id: I753153a9c8f5adeb9be516f60590bd3f33bc4923
Reviewed-on: https://dart-review.googlesource.com/c/88680
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2019-01-08 14:54:05 +00:00
Kevin Moore 6f3ce5b9e9 Fixes for SDK packages
Change-Id: I544e4e085cc1e420397d6d825a93376ae586f9a4
Reviewed-on: https://dart-review.googlesource.com/c/88681
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-01-08 14:53:42 +00:00