Commit Graph

19 Commits

Author SHA1 Message Date
Kevin Millikin be30b62e3d Remove the Kernel type inference listener
We have decided to move to a different API for Fasta/Analyzer
integration, one that doesn't involve compiling to Kernel or observing
type inference.  The listener API will become broken, so let's just
remove it before that happens.

We lose the ability to trace type inference so let's restore that
ability next.  The analyzer's resolution storer is not used, but that
code has been left.  The resolution applier will no longer work
without the resolution storer, so those tests have been disabled.

Change-Id: If9ac5aba2d5de7788d8a65f7fa8410599e636d21
Reviewed-on: https://dart-review.googlesource.com/42400
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-02-21 16:28:07 +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 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
Mike Fairhurst 30e0c886e4 Allow no return in a Future<void>, test for FutureOr<void>.
The latter was already passing (because FutureOr<void>.isVoid is true
already, which was a condition of early bailout for MISSING_RETURN).

The former was not working, but is now handled.

Unit tests for each.

Change-Id: I0f6e7ddc71940517c5746c1a5431f4491ee2eef3
Reviewed-on: https://dart-review.googlesource.com/37440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-02-05 23:13:05 +00:00
Paul Berry 68fd556216 Rework _validateTopLevelInitializer to use a visitor.
The old implementation only validated a whitelisted set of use cases,
so it would often miss important subexpressions.  The new
implementation is based on a RecursiveAstVisitor so by default it
visits all subexpressions; we use overrides for the specific cases
where it's not necessary to visit all subexpressions.

Fixes #31963.

Change-Id: Icb9833f51bef26874f655cd2ba4ffc509bfffef3
Reviewed-on: https://dart-review.googlesource.com/36803
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-25 21:47:46 +00:00
Sigmund Cherem e2ad2db805 Generate checks for library-is-loaded to fasta and dart2js.
Change-Id: Ibf453ca7390b81da7231dcb1be43e426c00d6eeb
Reviewed-on: https://dart-review.googlesource.com/35100
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-01-18 20:17:14 +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 2401b16846 Report HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE even if the superclass has noSuchMethod().
See the bug.
This does not make it a compile time error though.

R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/31593
Change-Id: Iefef8eecec43b6b8afaac74198bffbeae1c8b104
Reviewed-on: https://dart-review.googlesource.com/28120
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-04 20:32:05 +00:00
Konstantin Shcheglov f57a0511a4 Apply import prefixes in type annotations.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I185b9860aac8650856c8c13b6784b63f3fe2f379
Reviewed-on: https://dart-review.googlesource.com/32000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-01-02 22:34:04 +00:00
Konstantin Shcheglov 6d5f2f09aa Apply resolution to function expression invocations.
Bug:
Change-Id: I895cf9765664f1e9608ec612e4b1897f42cb9d70
Reviewed-on: https://dart-review.googlesource.com/31881
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-02 19:34:23 +00:00
Konstantin Shcheglov 990dba4e08 Apply resolution to import prefixes.
R=brianwilkerson@google.com

Bug:
Change-Id: I9598e11b21ea714f06ce33706c467a161091675a
Reviewed-on: https://dart-review.googlesource.com/31840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-12-30 19:32:19 +00:00
Konstantin Shcheglov 4804108735 Support for more than one variable defined in a statement.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I9c5163099e46639a58487d217c1895b21bbc754d
Reviewed-on: https://dart-review.googlesource.com/29440
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-12-13 22:14:24 +00:00
Konstantin Shcheglov 3f90f36380 Apply resolution to not procedures/methods invocations.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: I419245d819c68a28ecb328e78073cbe5373f7455
Reviewed-on: https://dart-review.googlesource.com/29360
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-12-13 21:13:14 +00:00
Brian Wilkerson 24a510a91e Enable previewDart2 for more tests
Change-Id: I1f2003040246b5b12f2866d513ff3502246ac39f
Reviewed-on: https://dart-review.googlesource.com/29220
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-12-13 18:15:45 +00:00
Konstantin Shcheglov 87410835d6 Resynthesize LibraryElement annotations from Kernel.
R=brianwilkerson@google.com

Bug:
Change-Id: I6ba30eff022d6a46fd7a19c887d13ebde243ce03
Reviewed-on: https://dart-review.googlesource.com/14121
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-16 20:26:08 +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 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 0549b3160e Run hint tests with Kernel.
R=brianwilkerson@google.com

Bug:
Change-Id: Iea76082755b09015717c19c18a38ffe61072df02
Reviewed-on: https://dart-review.googlesource.com/10201
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-10-02 22:31:38 +00:00