Commit Graph

124 Commits

Author SHA1 Message Date
Brian Wilkerson 830ec419b6 Cleanup warnings and sort a few files
Change-Id: Ie781e1dff7eb079311b833d4a13f7a1d38ef0515
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98603
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-04-03 17:51:36 +00:00
Sam Rawlins 8aabbf39e5 Move last meta-based hint code tests to diagnostics:
* INVALID_FACTORY_ANNOTATION
* INVALID_FACTORY_METHOD_IMPL
* INVALID_USE_OF_PROTECTED_MEMBER
* INVALID_USE_OF_VISIBLE_FOR_TEMPLATE
* INVALID_USE_OF_VISIBLE_FOR_TESTING
* MISSING_REQUIRED_PARAM

Change-Id: I3bb556f140dd61d8c707ae8db7ec2ce36d01ed97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98451
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-04-02 18:18:49 +00:00
Sam Rawlins 75b2f9f919 Move more HintCode tests to individual files:
* DUPLICATE_IMPORT
* IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION
* NULL_AWARE_*
* OVERRIDE_*

This puts non_hint_code_test alllllmost at empty.

Change-Id: Iade3a2fd29b484d711556ff688a6386789a50d0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98289
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-04-01 16:54:55 +00:00
Brian Wilkerson d0fda82493 Clean up some of the unused task model support in test code
Change-Id: I2a70070866e38377a4dd149b6407942e3f81c92d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98049
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-03-28 17:13:45 +00:00
Sam Rawlins 05be278603 Split MISSING_RETURN tests
Change-Id: I001d3dd2f1c2d1200ede738aa8d838fc0924ba1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-03-08 00:32:17 +00:00
Sam Rawlins bc02b6ce7d Split DEAD_CODE tests into their own file
Change-Id: I7d550ec240a10b839791cb5e00216c739af12d8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95666
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-07 18:28:37 +00:00
Paul Berry a2eac98753 Merge HintCodeTest_Driver into HintCodeTest.
This is necessary because the internal code base considers a test file
to fail if it doesn't run any tests.

Alternative fixes considered:

- Put a dummy test in hint_code_test.dart
- Rename hint_code_test.dart to a name that doesn't end in _test.dart

Change-Id: I64fa2be7c76b4d2a85ee9b46ba1a1c21ae2903ae
Reviewed-on: https://dart-review.googlesource.com/c/94800
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-02-28 17:50:09 +00:00
Sam Rawlins ffc1383918 Move tests of five more analyzer codes to diagnostics
Change-Id: Ieec95d8b8426d366ce2d9e911d02385842f13ee6
Reviewed-on: https://dart-review.googlesource.com/c/94468
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-27 19:12:17 +00:00
Sam Rawlins 9450c6d829 Move SUBTYPE_OF_SEALED_CLASS to own file, and DriverResolutionTest
Change-Id: I1c5372bba522f1c3c818a2a1eafb366794e4700a
Reviewed-on: https://dart-review.googlesource.com/c/93929
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-27 02:08:25 +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
Brian Wilkerson 0a2672453f Split out several more hint tests
Change-Id: I6483656ca2ac9c7cfa00249cf37ccbb78758ffb6
Reviewed-on: https://dart-review.googlesource.com/c/92533
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-02-10 18:51:22 +00:00
Paul Berry c9b1877cbf Disable task model for clients by making WorkItem inconstructible.
The task model is still allowed in analyzer tests since we still have
some unit tests of non-task-model functionality that rely on the task
model to do their testing (see #35734).

Unit tests whose sole purpose was to test the task model have been
removed.  Test files that now empty have been removed.  Non-empty test
files that now contain no tests of their own have had their `main`
functions removed, and have been renamed so that the testing
infrastructure will no longer attempt to run them.

Change-Id: I8b4d0b2dde9337c4e1fe91e443a2c9da6eee8f4f
Reviewed-on: https://dart-review.googlesource.com/c/90720
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-01-24 16:29:17 +00:00
Sam Rawlins b58aa3bcb2 Add PubWorkspace, integrate it into ContextBuilder, and therefore fix sealed test
Also add a superclass to BasicWorkspace and PubWorkspace, since the bulk of their
implementation is shared; Only find() and findPackageFor() need to be separate;
the package mapping and resolving can be shared.

Change-Id: I13932d6947d6dc28fc7223594e5bd2526f12f573
Reviewed-on: https://dart-review.googlesource.com/c/89167
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-14 21:36:49 +00:00
Brian Wilkerson 68ad94cebe Extract more hint tests into separate files
Change-Id: I110f815c6bb124596b31cf3bac739ed8604d6c3b
Reviewed-on: https://dart-review.googlesource.com/c/89100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-01-11 15:39:16 +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
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
Brian Wilkerson 555485c891 Start splitting out the tests for hint codes
Change-Id: I2d221aa024b6db9426d7adf6b38c17da0be599d9
Reviewed-on: https://dart-review.googlesource.com/c/88541
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-01-07 14:25:20 +00:00
Sam Rawlins ce256c762c Impl of INVALID_LITERAL_ANNOTATION
Bug: https://github.com/dart-lang/sdk/issues/34259
Change-Id: Ia5ca627a89dcb3f0fcd5ce74048df8fdf9dd9c9c
Reviewed-on: https://dart-review.googlesource.com/c/88283
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-03 18:07:44 +00:00
Sam Rawlins 31fa815dca Remove sealed ability on mixin
Change-Id: I69f59dfaa18d77fcd53f82b71a79c567102a9b66
Reviewed-on: https://dart-review.googlesource.com/c/88200
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-03 01:51:35 +00:00
Sam Rawlins 0d744a51da Allow and enforce @immutable on mixins and mixin applications
Bug: https://github.com/dart-lang/sdk/issues/35459
Change-Id: I094e12ec997a63fee65ff7a783ab112a11930af9
Reviewed-on: https://dart-review.googlesource.com/c/88223
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-01-03 00:11:40 +00:00
Sam Rawlins 428629efd8 Enforce sealed annotation on classes and mixins
This CL replaces https://dart-review.googlesource.com/c/sdk/+/75941
(there were some large refactorings, and I got a new laptop and lost my Git repo)

Bug: https://github.com/dart-lang/sdk/issues/34232
Change-Id: Ia0746b94a23ccb757bc209e76098243896be8c55
Reviewed-on: https://dart-review.googlesource.com/c/88127
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-02 18:07:52 +00:00
Brian Wilkerson 737209b85c Remove some unused hint codes
Change-Id: I1388355e7832dec17ed06da14262573ea4e60eef
Reviewed-on: https://dart-review.googlesource.com/c/88161
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-12-31 16:23:28 +00:00
Sam Rawlins ac506a9d92 Check for @immutable on mixin application. Fixes #35458
Bug: https://github.com/dart-lang/sdk/issues/35458

Change-Id: I884a64784dea370cf7f8df65a6e44d2287178677
Reviewed-on: https://dart-review.googlesource.com/c/87708
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2018-12-19 23:38:16 +00:00
Brian Wilkerson 22408c6dee Remove references to previewDart2
Change-Id: Id382dd95d3ae90d483467741b5b6d3dbc6c31ea1
Reviewed-on: https://dart-review.googlesource.com/c/83300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-07 14:52:37 +00:00
Konstantin Shcheglov f5758b74c8 Report missing '[]' and '[]=' operators separately.
R=brianwilkerson@google.com

Change-Id: I729d76c3373ab0eba3e191a5a79f6d2a34a97e23
Reviewed-on: https://dart-review.googlesource.com/c/81222
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-23 15:46:51 +00:00
Konstantin Shcheglov c44fa48f8f Extract and rewrite MethodInvocation resolution.
This is a copy of https://dart-review.googlesource.com/c/sdk/+/78182,
but now in the analyzer branch.

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

Change-Id: I75d17a351ee7a33c164d560009cf3ffd088d956a
Reviewed-on: https://dart-review.googlesource.com/c/80942
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-22 03:36:30 +00:00
Konstantin Shcheglov 20f4349951 Fix for reporting INVALID_USE_OF_PROTECTED_MEMBER in documentation comments.
R=brianwilkerson@google.com, devoncarew@google.com

Bug: https://github.com/dart-lang/sdk/issues/34816
Change-Id: Ifb46351f83405e862fb5f28b669fa151ab0e2f8f
Reviewed-on: https://dart-review.googlesource.com/c/80267
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2018-10-16 17:29:37 +00:00
Brian Wilkerson d2c5a24fd9 Recognize mixins as subtypes of their superclass constraints in hint generation (issue 34633)
Change-Id: I84b86e998ec353c13b18a460f2a7ca8cb0802204
Reviewed-on: https://dart-review.googlesource.com/77665
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-02 19:20:35 +00:00
Konstantin Shcheglov f89053aecc Report ABSTRACT_SUPER_MEMBER_REFERENCE as error.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/33662
Change-Id: Ic80386c20acd2cd1ceebeb90fbb1d6e18982b024
Reviewed-on: https://dart-review.googlesource.com/74499
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-12 17:07:18 +00:00
Konstantin Shcheglov a02a589813 Keep just one UNDEFINED_GETTTER/METHOD/SETTER error.
There is no distinction between them from the langauge of view anymore.

This is a preparatory step before reporting super-invoked abstract
class members as errors, which we should do according to the issue.

Which, in turn, is for consistency between repoting corresponding
error for super-invoked, but not concrete members in mixin applications.

R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/33662
Change-Id: I00e8f185dbbdd1ffac88c500394a1e1497be6f9a
Reviewed-on: https://dart-review.googlesource.com/74481
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-11 18:40:02 +00:00
Konstantin Shcheglov e96652352d Resolve mixin declarations.
Errors for onClause are not correct yet, and not tested yet.

R=brianwilkerson@google.com

Change-Id: I9a1f2b4734661baac85a9d1b9311d21104c7c495
Reviewed-on: https://dart-review.googlesource.com/72360
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-31 16:11:21 +00:00
Konstantin Shcheglov 1f52372bfa Remove CFE integration from analyzer, analysis_server, and analyzer_cli.
AnalysisDriverResolutionTest is partially updated, about 30 failing
tests added. I will get back to it in a following CL, it is not
directly CFE integration, but updated understanding how we want to
resolve. For example we don't need types for non-expression identifiers.

Change-Id: I3daddbb6c66ffad7a726f3313a1199fd7387aa04
Reviewed-on: https://dart-review.googlesource.com/71883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-29 13:46:45 +00:00
Sam Rawlins ff3908d6df Implement INVALID_SEALED_ANNOTATION analyzer Hint
This follows the pattern of other meta-annotations, when it comes to the AST:

* Element gains a new `hasSealed` getter. Many overrides.
* ElementAnnotation gains a new `isSealed` getter.

Bug: https://github.com/dart-lang/sdk/issues/34232
Change-Id: If8ae8e16b500125cb3b92b3cf83d46de6ca6ee23
Reviewed-on: https://dart-review.googlesource.com/71227
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-23 22:03:22 +00:00
Keerti Parthasarathy b99e41ac6f Revert "fix #28233, add hint for missing returns to function expressions"
This reverts commit 058510eeab.

This causes a lot of missing_return failures internally and requires time to fix.

Change-Id: I2c7a79c6e838bbd9f101f53919b1db2c0d4a2594
Reviewed-on: https://dart-review.googlesource.com/70024
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2018-08-14 21:10:27 +00:00
Konstantin Shcheglov 666c8c1a89 Fix @visibleForTemplate tests on Windows.
TBR

R=brianwilkerson@google.com

Change-Id: I97ac89b7f3207a60fb2512a2a0af5aba231a7a35
Reviewed-on: https://dart-review.googlesource.com/69244
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-09 22:52:33 +00:00
Sam Rawlins 7818db20a7 Add analysis hint for invalid use of @visibleForTemplate code.
Bug: https://github.com/dart-lang/sdk/issues/33353
Change-Id: Iaafccc3dca6b8d87bd54ed721871c72e9ac456c8
Reviewed-on: https://dart-review.googlesource.com/68432
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-09 16:51:45 +00:00
Brian Wilkerson 87f753dbd3 Replace some declarations of element with declaredElement
Change-Id: Idd62472b16cccaa98749a510197ec8d0f5053cb1
Reviewed-on: https://dart-review.googlesource.com/67820
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-08-02 16:00:36 +00:00
Jenny Messerly 058510eeab fix #28233, add hint for missing returns to function expressions
If a function expression is used in a context that expects a return type
other than dynamic/void/Null, issue a hint if that function has a block
body and is missing a `return` statement.

Change-Id: Ia55212abd84f5718343cf7401b87aba2891d6446
Reviewed-on: https://dart-review.googlesource.com/66340
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-28 01:50:31 +00:00
Brian Wilkerson dcb95dba3e Update the failing tests in HintCodeTest_Kernel
Change-Id: Ie10f509c9ecadc0d8b7391ff08e79adf91600576
Reviewed-on: https://dart-review.googlesource.com/66101
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-07-23 16:25:11 +00:00
Jenny Messerly 3320d8f677 fix #31237, missing return hint was missing for inferred returns
Change-Id: I3c8c59f31196b220aaa0421f8357a950ff16ba20
Reviewed-on: https://dart-review.googlesource.com/62727
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-07-19 00:19:24 +00:00
Brian Wilkerson ab1c1582b1 Remove deprecation hints in analyzer packages
Change-Id: I001e57239a87f2806be74052a5e7686245fea812
Reviewed-on: https://dart-review.googlesource.com/65000
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2018-07-17 15:22:07 +00:00
Devon Carew 2dd33c2a6c Have the package:analyzer strong mode option hard coded to on. Delete several spec mode only tests.
Change-Id: I5dffec68d9845fe75936d55100c03306b6eda363
Reviewed-on: https://dart-review.googlesource.com/64060
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-07-10 05:30:10 +00:00
Leaf Petersen 8e9e8e1da0 Fix various bugs and regularize behavior of returns statements in
various kinds of functions.

Closes-bug: #31887
Closes-bug: #30638
Closes-bug: #32233
Closes-bug: #32881
Closes-bug: #31278
Change-Id: I4ebd7e71096d611e189b571ba5de2998dd11c98b
Reviewed-on: https://dart-review.googlesource.com/60300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2018-06-15 16:07:44 +00:00
Sam Rawlins cc9c8f93f5 Add HintCode for duplicate shown/hidden names
Bug: https://github.com/dart-lang/sdk/issues/33182
Change-Id: Ibb82c44357bc59044340c6d8b1904c7815d19215
Reviewed-on: https://dart-review.googlesource.com/57161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2018-05-30 17:22:40 +00:00
Janice Collins 1afe71c08a Enable preview-dart-2 as default for analyzer.
Based on https://dart-review.googlesource.com/c/sdk/+/52340, but adds
the necessary plumbing through the test system to pass through
negations to strong and preview-dart-2.  Also adds support for those
negations to the analyzer.

Change-Id: I9793ff28bb593d25bbb0a2ed8736b5b53e0a62d8
Reviewed-on: https://dart-review.googlesource.com/52461
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-26 17:01:12 +00:00
Brian Wilkerson 26c06cdd82 Clean up Dart 2 type issues related to YAML support
Change-Id: Ic29054afca9773286aa899eecede287f7ecbca9a
Reviewed-on: https://dart-review.googlesource.com/47680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-22 17:06:40 +00:00
Brian Wilkerson 8819d9fe98 Update analyzer tests for preview-dart-2, part 1
Change-Id: I3440607f7b3892193e1d9883709a1b9d4a7463d9
Reviewed-on: https://dart-review.googlesource.com/46562
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 16:45:04 +00:00
Alexandre Ardhuin 3caa0f9fee more null-aware hints
This adds 2 new hints `NULL_AWARE_BEFORE_OPERATOR` and `NULL_AWARE_IN_LOGICAL_OPERATOR`.

The previous `NULL_AWARE_IN_CONDITION` hint didn't catch null-aware issues in assigments or expression statements with logical operators. `NULL_AWARE_IN_LOGICAL_OPERATOR` handles those cases.

`NULL_AWARE_BEFORE_OPERATOR` handle issue like `a?.b + c`.

Closes #32239
https://github.com/dart-lang/sdk/pull/32239

GitOrigin-RevId: 8b20ec5f7ea7901b1d0889eaf54ad0660c6e3f76
Change-Id: I36ada68c13dd0e1dd2bfd829ae25ce3ba9c8f402
Reviewed-on: https://dart-review.googlesource.com/42360
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-02-20 21:48:35 +00:00
Mike Fairhurst 56d59dd967 Reland https://dart-review.googlesource.com/c/sdk/+/37441 with fixes
Change-Id: If8e2ec2ca1ac4f533dcb56b0c95d55e4a13e0598
Reviewed-on: https://dart-review.googlesource.com/39881
Reviewed-by: Paul Berry <paulberry@google.com>
2018-02-08 20:46:19 +00:00
Mike Fairhurst ec58f5646a Revert "Make void a static warning to use almost everywhere."
This reverts commit 09eed74a8a.

Reason for revert: Too much SDK code is not yet compliant.

Original change's description:
> Make `void` a static warning to use almost everywhere.
> 
> Changed the hint to a StaticWarningCode, since that's the new spec'd
> error type and the hint is no longer needed.
> 
> Added a new set of methods to test the cases.
> 
> Didn't try to solve the problem generally ("all usages except ... are
> errors" means it easier, in theory, to make a ReportVoidExpressions
> style visitor that catches absolutely all types) because most of the
> work is actually about suppressing errors that are no longer needed.
> Ie, from NO_SUCH_METHOD to USAGE_OF_VOID_RESULT which means we have to
> put the void handling logic into each AST method specially anyway.
> 
> Some redundant tests removed.
> 
> Don't flag: ternaries, void -> void assignments, void returns in
> dynamic.
> 
> Change-Id: Ief8035dcfe582b36b6372180ddcf4e453d320d9c
> Reviewed-on: https://dart-review.googlesource.com/37441
> Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>

TBR=leafp@google.com,scheglov@google.com,mfairhurst@google.com

Change-Id: I13ee4c6939468d35506779ade637a040833632f4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/39848
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-02-07 22:32:51 +00:00