Commit Graph

24 Commits

Author SHA1 Message Date
Mike Fairhurst cc6b4219a5 Remove more methods I somehow missed that I needed to remove
Change-Id: I528b8a74db0c13e7868f79e5584712c317b01f3d
Reviewed-on: https://dart-review.googlesource.com/40105
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-02-08 23:06:32 +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
Mike Fairhurst 09eed74a8a 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>
2018-02-07 21:36:01 +00:00
Sigmund Cherem f541f060ee [fe] deferred access checks for several access patterns of classes.
This adds checks for allocations and type values, and provides a compile
time error for type declarations, is-checks, and as-casts.

Change-Id: I3bfed41b0dd45abeb02158f0537102c779511998
Reviewed-on: https://dart-review.googlesource.com/36383
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-02-02 20:44:16 +00:00
Brian Wilkerson b74ceb0248 Remove a warning (issue 31351)
Change-Id: Id798aa7ece345970e3bfba15b260df6482a57074
Reviewed-on: https://dart-review.googlesource.com/37861
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-01-31 20:42:26 +00:00
Paul Berry 314b89e11d Update the analyzer to require noSuchMethod overrides to be concrete.
See 38dcb10543 for details.

Change-Id: I00608f7106e1b37cde81b8145d8d748f8cd97804
Reviewed-on: https://dart-review.googlesource.com/36520
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-01-24 13:55:18 +00:00
Jaime Wren cd878bc433 Create the new flag --use-cfe in the analyzer, analysis server and analyzer_cli and migrate the old behavior of --preview-dart-2 to --use-cfe. The --preview-dart-2 flag is now a no-op, with functionality coming soon.
See https://github.com/dart-lang/sdk/issues/31640

Change-Id: I2db2e7ef6a324cbd5d369b807e331495fed167df
Reviewed-on: https://dart-review.googlesource.com/33121
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
2018-01-08 22:37:05 +00:00
Konstantin Shcheglov 76c5a9a6c8 Convert errors from FrontEnd into Analyzer.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I94f219e378437e0bcff3ee8e2ca0598594e59afc
Reviewed-on: https://dart-review.googlesource.com/32143
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-03 20:05:25 +00:00
Leaf Petersen 53908b0790 Remove warning for "is" checks with generic type parameters.
The analyzer used to emit a warning when a type parameter to a generic
method was used in an "is" check.  This warning was there to help
users write code that worked correctly on both Dart 1.0 and 2.0.  Now
that 2.0 generic methods are being more broadly supported and used,
this warning is blocking further library work, and is being removed.

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

Bug:
Change-Id: I70395305ad082aee3072b5beeb0b1b7f7883391b
Reviewed-on: https://dart-review.googlesource.com/29821
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-12-15 18:12:03 +00:00
Sam Rawlins ee07335392 Improve message around re-assigning a local final.
Add a new ASSIGNMENT_TO_LOCAL_FINAL code for the new text.

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

Bug: https://github.com/dart-lang/sdk/issues/28721
Change-Id: I5492dd0d9ee09d5b73296b46fe10271661c3c64f
Reviewed-on: https://dart-review.googlesource.com/29621
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-12-15 01:09:55 +00:00
Mike Fairhurst 62e5c677a8 Enable previewDart2 in static warning code kernel tests. Others passing.
Enable previewDart2 and annotate all @potentialAnalyzerProblems.

Also fix two of the @failingTests related to
https://github.com/dart-lang/sdk/issues/31073 which appear to be
passing now.
Bug:
Change-Id: Ic2fd534c8a9cf45eccf0f5d09dc47cd4e78aaf42
Reviewed-on: https://dart-review.googlesource.com/27468
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2017-12-08 18:31:58 +00:00
Konstantin Shcheglov bd49ff15bf Record constructor name offset in metadata.
This fixes 70 Analyzer tests.

R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug:
Change-Id: If7e3fa948aa67712eab5533b083757a75a981e14
Reviewed-on: https://dart-review.googlesource.com/13926
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-16 18:29:37 +00:00
Konstantin Shcheglov afaf47e29b Triage the rest of StaticWarningCodeTest_Kernel as Fasta problems.
Unfortunately there are nothing we can fix at the Analyzer side yet.

R=brianwilkerson@google.com

Bug:
Change-Id: I859f8608833fcdf254bf811906475ffec871665c
Reviewed-on: https://dart-review.googlesource.com/13241
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-11 18:32:50 +00:00
Konstantin Shcheglov 4c6322ac16 Triage StaticWarningCodeTest_Kernel and fix one problem.
R=brianwilkerson@google.com

Bug:
Change-Id: I26d1f30fca0928d1ec00bfba932975734a1c1b7a
Reviewed-on: https://dart-review.googlesource.com/13181
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-11 18:00:25 +00:00
Konstantin Shcheglov 7d9188aea1 Add FallThroughError that is used by Fasta.
R=brianwilkerson@google.com

Bug:
Change-Id: Iff5a981f7ce9e9693996bc18493c13b2d88e5f6d
Reviewed-on: https://dart-review.googlesource.com/12782
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-10-11 02:02:40 +00:00
Konstantin Shcheglov b7d00a8712 Add _DuplicatedFieldInitializerError that is used by Fasta to report compilation errors in Kernel.
R=brianwilkerson@google.com

Bug:
Change-Id: I27ef95ecb53a37fa1543fd65e3a6ea09974f3b56
Reviewed-on: https://dart-review.googlesource.com/10840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-04 16:24:52 +00:00
Konstantin Shcheglov 8d0c0bae0b Triage tests failing because of import/export and duplicate declarations.
R=brianwilkerson@google.com

Bug:
Change-Id: I771c33de3f719483d65b8415f4ce61e4335cd84e
Reviewed-on: https://dart-review.googlesource.com/10162
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-02 20:56:02 +00:00
Konstantin Shcheglov e8fe137e94 Remove ExecutableElement.functions and don't resynthesize local functions.
As for all other local elements - variables and labels, we now
created them when we analyze the unit, but we don't export them
through the element model.

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

Bug:
Change-Id: I71eb567f58d6d710fc8a58d1653a66d95ef1ddcd
Reviewed-on: https://dart-review.googlesource.com/9861
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-01 21:08:04 +00:00
Konstantin Shcheglov b5fc2de3bf Keep sources for libraries of the current cycle.
This should fix the issue 30917 flakiness.

The reason why the tests were failing is that the code in the tests
was not quite correct Dart code, so Fasta generated a synthetic
`#errors` top-level variable with fileUri == null. We should skip
this field because it is not a part of any unit, because its fileUri
is not the fileUri of any unit.

But we lose fileUri for a Node if Program.uriToSource does not
include this URI. So, if we clear uriToSource in KernelDriver, we
lose all the file URIs. So, now we keep sources for the cycle files.

The reason for flakiness is because of the same race condition
between analyzing AnalysisDriver.addFile() and getResult(). If
we process getResult() before, we don't have to read the library
kernel file, we just create in first time, and fileUri(s) are
valid.

R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug: https://github.com/dart-lang/sdk/issues/30917
Change-Id: Ie559cf2a8a778ebf4a9e297f5cb13d30a98b5a3c
Reviewed-on: https://dart-review.googlesource.com/9744
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-09-29 18:38:52 +00:00
Konstantin Shcheglov c6ba28a5a8 Create (empty) initializers for parameters resynthesized from Kernel.
R=brianwilkerson@google.com

Bug:
Change-Id: I1fc4d7db27951fb0e094dc685eb3e0bde4663e68
Reviewed-on: https://dart-review.googlesource.com/8162
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-25 17:13:18 +00:00
Konstantin Shcheglov f575c099b0 Run all *_driver tests also with Kernel. (attempt #2)
With previous changes that fix finding dart:core on Windows and
flakyness of reporting import errors, I'd like to reland this CL.

Attempt #1: https://dart-review.googlesource.com/c/sdk/+/7624

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

Bug:
Change-Id: If5ab2c5ebe2204df6643ee42cbee5b49fb2d8c31
Reviewed-on: https://dart-review.googlesource.com/7961
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-24 18:27:27 +00:00
William Hesse 2274739c3c Revert addition of kernel tests to analyzer unit tests
These tests have flaky failures on the buildbots and commit queue.
Revert "Run all *_driver tests also with Kernel."

This reverts commit d2f887e37b.

Revert "Adjusted status for analyzer/test/generated/strong_mode_kernel_test"

This reverts commit 055654e96d.

Revert "Made status for strong_mode_kernel_test broader (flaky)."

This reverts commit 824c3f56cc.

Bug:
Change-Id: I341762671efc31f168df2f5806653d9548bd43ae
Reviewed-on: https://dart-review.googlesource.com/7708
Reviewed-by: William Hesse <whesse@google.com>
2017-09-22 11:37:21 +00:00
Konstantin Shcheglov d2f887e37b Run all *_driver tests also with Kernel.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I92a0f5f2192c20276b166a9211ab1064bc6f2b82
Reviewed-on: https://dart-review.googlesource.com/7624
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-21 22:44:39 +00:00