Commit Graph

5171 Commits

Author SHA1 Message Date
Konstantin Shcheglov dcefeb17b6 Set ClassElement implicit instance creation.
I also changed tests to be a bit more specific - test whether elements
are class and constructor where one is expected. Not found additional
problems though.

R=brianwilkerson@google.com

Change-Id: I95cf57e46620149740d6c748a6065b3b2e00409e
Reviewed-on: https://dart-review.googlesource.com/42027
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-16 19:49:57 +00:00
Konstantin Shcheglov 6e912ff3ed Don't cast to LibraryElementImpl.
Also run PreviewDart2Test with analysis driver, that's how it is actually
used.

R=brianwilkerson@google.com

Change-Id: I6757d7435c376a07fa1ef00b495b5fab0d118924
Reviewed-on: https://dart-review.googlesource.com/42023
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-16 18:17:07 +00:00
Konstantin Shcheglov 670c288711 Issue 32162. Fix for crash in generic function type argument of unresolved class.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32162
Change-Id: I0a2df5bf5a08b52a7eb47e1b8265b9bbbf65e599
Reviewed-on: https://dart-review.googlesource.com/41922
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-16 01:01:16 +00:00
Konstantin Shcheglov d9a44c9dc7 Revert "Normalize Windows drive letters to uppercase for analysis"
This reverts commit 56acaee9b1.

See https://github.com/dart-lang/sdk/issues/32186

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

Change-Id: I76c673758e4b9acd22044985b4054b5504f4a205
Reviewed-on: https://dart-review.googlesource.com/41902
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-02-15 22:10:56 +00:00
kmillikin b019045393 Front-end implementation of mixin type inference.
Infer missing type arguments to generic mixin classes in mixin
applications based on mixin supertype constraints.  The implementation
directly follows the draft feature specification at
https://dart-review.googlesource.com/c/sdk/+/38940.

Bug: https://github.com/dart-lang/sdk/issues/31984
Change-Id: I7caba037b1b0e73c44f71aaa958f3ff3e8f3c1f0
Reviewed-on: https://dart-review.googlesource.com/40661
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-02-14 22:43:24 +00:00
Mike Fairhurst 470f28e3c6 Fix #31345 include analysis_options breaks some properties
Bug: 31345
Change-Id: I8d588cc49931ccb4699cc33c8e12a7f701a0a513
Reviewed-on: https://dart-review.googlesource.com/41500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-02-14 21:32:44 +00:00
Janice Collins 121a8ebcb2 Prepare for analyzer 0.31.2-alpha.0.
Update changelog and versions prior to publish, primarily for the crash
in computeNode fixed by https://github.com/dart-lang/sdk/commit/3791ddb496a2d8c9ed9bc2edcc62e562c2e47eb2#diff-ff9cb85838db7a802ac5aa9c55f26d86.

Change-Id: If3bbe3238fb622d884cee5df87a06a90b401fe7e
Reviewed-on: https://dart-review.googlesource.com/41040
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-02-14 21:22:54 +00:00
Dan Rubel 577fc049d8 Update fasta parser recovery tests
Change-Id: Ie2116e9c99c615238199542a147c7240f31fb659
Reviewed-on: https://dart-review.googlesource.com/41101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-02-14 18:01:14 +00:00
Dan Rubel dd0a08a75e Improve fasta parser error reporting
This CL updates the fasta parser to report more errors
and have improved recovery. The new errors reported include:

* IllegalAssignmentToNonAssignable
* MissingAssignableSelector
* StaticConstructor

In addition, a number of test expectations were updated
to match the errors already produced by the fasta parser.

Change-Id: I99889e8e64663ca5b81a5d5d8f5e5241d049a0a2
Reviewed-on: https://dart-review.googlesource.com/41100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-02-14 18:01:14 +00:00
Brian Wilkerson a83bcc8235 Check for unresolved imports too avoid breaking when handling optional new and const (issue 32150)
Change-Id: Ia7cc162e0e615ce324acb230e1d0bbf59d89ffa1
Reviewed-on: https://dart-review.googlesource.com/41380
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-14 17:42:13 +00:00
Brian Wilkerson 75a2a1524f Support updated optional new and const spec
Change-Id: I974185eba4936f14d7b9d5d1d5c1638a37624c62
Reviewed-on: https://dart-review.googlesource.com/41024
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-02-14 17:12:13 +00:00
Paul Berry c4de71ede2 Re-land "Change front_end handling of callable classes."
Original description:
Change front_end handling of callable classes.

This CL is the first in a series of CLs to change the handling of
callable classes in Dart 2.0.

For purposes of this description, a "callable class" is a class whose
interface contains a `.call` method.

In Dart 1.0, a callable class was considered to be a subtype of the
`.call` method's function type.  This allowed the user to create
custom objects with similar behavior to closures, but with additional
fields and methods.

In Dart 2.0, a callable class is just an ordinary class, with no
subtype relation to any particular function type.  (Note however that
it is still permissible for a class to declare that it "implements
Function").

To reduce the amount of code broken by this change, a piece of
syntactic sugar is being added: if an expression whose static type is
a callable class appears where a function type is expected, an
implicit tear-off of the `.call` method is inserted.

Note that it is still possible at compile time to invoke an expression
whose static type is a callable class, and it is still possible at
runtime to invoke an expression whose runtime type is a callable
class; in both cases, this is considered an implicit invocation of the
class's `.call` method.  This is unchanged from Dart 1.0 behavior.

This CL introduces test cases for the new behavior, and implements the
implicit tear-off of `.call` in the front end.

Still to be implemented in future CLs:

- Spec text needs to be written.

- DDC/analyzer code needs to be written to perform implicit tear-offs
  of `.call`.

- The subtyping algorithm in DDC, analyzer, VM, and dart2js needs to
  be changed so that callable classes are no longer considered
  subtypes of any particular function type.

- A small corner case involving type parameters still needs to be
  addressed (see TODO in
  pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart).

Fixes #32064.

Change-Id: I0d397c608321e25ba42cc02aa8a516aa77aa7c9d
Reviewed-on: https://dart-review.googlesource.com/41280
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-14 15:22:25 +00:00
Paul Berry e2bdbb8bb8 Revert "Change front_end handling of callable classes."
This reverts commit f0a6330db0.

Reason for revert: Broken bots

Original change's description:
> Change front_end handling of callable classes.
> 
> This CL is the first in a series of CLs to change the handling of
> callable classes in Dart 2.0.
> 
> For purposes of this description, a "callable class" is a class whose
> interface contains a `.call` method.
> 
> In Dart 1.0, a callable class was considered to be a subtype of the
> `.call` method's function type.  This allowed the user to create
> custom objects with similar behavior to closures, but with additional
> fields and methods.
> 
> In Dart 2.0, a callable class is just an ordinary class, with no
> subtype relation to any particular function type.  (Note however that
> it is still permissible for a class to declare that it "implements
> Function").
> 
> To reduce the amount of code broken by this change, a piece of
> syntactic sugar is being added: if an expression whose static type is
> a callable class appears where a function type is expected, an
> implicit tear-off of the `.call` method is inserted.
> 
> Note that it is still possible at compile time to invoke an expression
> whose static type is a callable class, and it is still possible at
> runtime to invoke an expression whose runtime type is a callable
> class; in both cases, this is considered an implicit invocation of the
> class's `.call` method.  This is unchanged from Dart 1.0 behavior.
> 
> This CL introduces test cases for the new behavior, and implements the
> implicit tear-off of `.call` in the front end.
> 
> Still to be implemented in future CLs:
> 
> - Spec text needs to be written.
> 
> - DDC/analyzer code needs to be written to perform implicit tear-offs
>   of `.call`.
> 
> - The subtyping algorithm in DDC, analyzer, VM, and dart2js needs to
>   be changed so that callable classes are no longer considered
>   subtypes of any particular function type.
> 
> - A small corner case involving type parameters still needs to be
>   addressed (see TODO in
>   pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart).
> 
> Fixes #32064.
> 
> Change-Id: I6a86491047ae467a5e767cb3cc7cecb570b29308
> Reviewed-on: https://dart-review.googlesource.com/40508
> Commit-Queue: Paul Berry <paulberry@google.com>
> Reviewed-by: Kevin Millikin <kmillikin@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>
> Reviewed-by: Erik Ernst <eernst@google.com>

TBR=paulberry@google.com,lrn@google.com,leafp@google.com,dmitryas@google.com,eernst@google.com,kmillikin@google.com

Change-Id: Ia3d3a6e46ceee2b2c55938bec95d09d50bbf06a7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/41240
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-14 13:10:54 +00:00
Paul Berry 421db9c69c Re-land "Implement proper checking for callability of Function class."
(was reverted in https://dart-review.googlesource.com/c/sdk/+/40980
due to an analyzer bot breakage)

Original commit message:
Implement proper checking for callability of Function class.

There was some old (incorrect) logic for doing this, behind the flag
enableStrictCallChecks.  This flag has been removed, since the new
behavior is now standard in Dart 2.0.

Fixes #31509

Change-Id: Ice5cf38bbc648badf7f2563ff930b69f9a799635
Reviewed-on: https://dart-review.googlesource.com/41120
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-14 11:30:23 +00:00
Paul Berry f0a6330db0 Change front_end handling of callable classes.
This CL is the first in a series of CLs to change the handling of
callable classes in Dart 2.0.

For purposes of this description, a "callable class" is a class whose
interface contains a `.call` method.

In Dart 1.0, a callable class was considered to be a subtype of the
`.call` method's function type.  This allowed the user to create
custom objects with similar behavior to closures, but with additional
fields and methods.

In Dart 2.0, a callable class is just an ordinary class, with no
subtype relation to any particular function type.  (Note however that
it is still permissible for a class to declare that it "implements
Function").

To reduce the amount of code broken by this change, a piece of
syntactic sugar is being added: if an expression whose static type is
a callable class appears where a function type is expected, an
implicit tear-off of the `.call` method is inserted.

Note that it is still possible at compile time to invoke an expression
whose static type is a callable class, and it is still possible at
runtime to invoke an expression whose runtime type is a callable
class; in both cases, this is considered an implicit invocation of the
class's `.call` method.  This is unchanged from Dart 1.0 behavior.

This CL introduces test cases for the new behavior, and implements the
implicit tear-off of `.call` in the front end.

Still to be implemented in future CLs:

- Spec text needs to be written.

- DDC/analyzer code needs to be written to perform implicit tear-offs
  of `.call`.

- The subtyping algorithm in DDC, analyzer, VM, and dart2js needs to
  be changed so that callable classes are no longer considered
  subtypes of any particular function type.

- A small corner case involving type parameters still needs to be
  addressed (see TODO in
  pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart).

Fixes #32064.

Change-Id: I6a86491047ae467a5e767cb3cc7cecb570b29308
Reviewed-on: https://dart-review.googlesource.com/40508
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-02-14 11:03:32 +00:00
Paul Berry 35aea15097 Revert "Implement proper checking for callability of Function class."
This reverts commit 6837dafcc3.

Reason for revert: Broke analyzer bots.

Original change's description:
> Implement proper checking for callability of Function class.
> 
> There was some old (incorrect) logic for doing this, behind the flag
> enableStrictCallChecks.  This flag has been removed, since the new
> behavior is now standard in Dart 2.0.
> 
> Fixes #31509
> 
> Change-Id: I4a6da34a4b85ea8409f6e0d14c377a586546056a
> Reviewed-on: https://dart-review.googlesource.com/40509
> Commit-Queue: Paul Berry <paulberry@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Mike Fairhurst <mfairhurst@google.com>

TBR=paulberry@google.com,scheglov@google.com,brianwilkerson@google.com,mfairhurst@google.com

Change-Id: Ib631ad16bc5e937ff914127d1c5330f3fcaff2c9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/40980
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-13 19:56:35 +00:00
Danny Tuppeny 56acaee9b1 Normalize Windows drive letters to uppercase for analysis
This fixes #32095, ~~however I'm currently unable to get the tests running locally. I'll continue to work on that, but I'm hoping that creating a PR runs all the tests on CI so we should at least get to see if this (legitimately) broke anything in the meantime?~~

Turns out this also fixes #32042! I can't run the latest analyzer code against a version of the SDK that the flutter_tools is happy with, however I rolled my analyzer code back to `2.0-dev.22` and repro'd this error, then applied the same changes from this PR to that version, and the errors went away.

Turns out to also fix #28895!

@bwilkerson

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

GitOrigin-RevId: 94cc37479214beaf1c8e3e2befa9bef882dbcd5d
Change-Id: I32a5ce52c7b28e1d484c1e5e9a9dd6d64c2b1b3b
Reviewed-on: https://dart-review.googlesource.com/40720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-13 19:36:36 +00:00
Paul Berry 16e60b76a9 Delete unused class NonErrorResolverSpecTest
Change-Id: I41d28f102fd04ba9e27451c0c3cc2e0d216aaffc
Reviewed-on: https://dart-review.googlesource.com/40760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-13 14:33:57 +00:00
Paul Berry 6837dafcc3 Implement proper checking for callability of Function class.
There was some old (incorrect) logic for doing this, behind the flag
enableStrictCallChecks.  This flag has been removed, since the new
behavior is now standard in Dart 2.0.

Fixes #31509

Change-Id: I4a6da34a4b85ea8409f6e0d14c377a586546056a
Reviewed-on: https://dart-review.googlesource.com/40509
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2018-02-13 14:19:08 +00:00
Mike Fairhurst e9c5abdaca Remove @override for test method that was renamed & now passes to fix build
Change-Id: I69138be190092681d4bdf1d06936f06a9a1bddab
Reviewed-on: https://dart-review.googlesource.com/40621
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-02-12 22:30:12 +00:00
Mike Fairhurst 7a0a9284ba Relax void errors: no error assigning void to void variable (+tests)
Change-Id: I1a6e80125dff6f766c9a74b760b557609a2544fb
Reviewed-on: https://dart-review.googlesource.com/40507
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-02-12 21:24:19 +00:00
Konstantin Shcheglov 3791ddb496 Keep unresolved import/export directives for task based analysis.
Bug: https://github.com/dart-lang/angular/issues/801
Change-Id: If8bdcbfdc10d3aae914391573c5eb2e7beb26a8f
Reviewed-on: https://dart-review.googlesource.com/40600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-12 21:20:49 +00:00
Brian Wilkerson 15343b5271 Fix several recovery tests to expect errors in the valid code
Change-Id: I242e17fb0413b3188de72815afd08980f1a8889d
Reviewed-on: https://dart-review.googlesource.com/40502
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-12 15:08:37 +00:00
Paul Berry a895c9b283 Promote TOP_LEVEL_CYCLE to an error
Top level type inference cycles constitute a compile-time error in
Dart 2.0.

Change-Id: I8663ea126fec2a4f495ee77125e9145372855934
Reviewed-on: https://dart-review.googlesource.com/40260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-12 11:04:48 +00:00
Dan Rubel df77ee3474 Refactor parseInitializer
Change-Id: I7c5b0ebddeb7dabaa0f3e6c5976ba4d9553f950a
Reviewed-on: https://dart-review.googlesource.com/40440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-02-10 15:50:39 +00:00
Janice Collins 75a2661f0e Prepare to publish analyzer 0.31.1 and associated packages.
Verified that the new analyzer at least smoke-tests on .21 still,
so did not update SDK constraints.  Publish is to address
dart-lang/dartdoc#1603.

Change-Id: I39320e5557344f6c1c79df50b792246fc1c29840
Reviewed-on: https://dart-review.googlesource.com/40401
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2018-02-09 18:29:29 +00:00
danrubel 87a395bd09 Allow "Function" as prefixed identifier
Change-Id: Id8dd154d8e3426a9a01d548af94d413e97590c76
Reviewed-on: https://dart-review.googlesource.com/40320
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-02-09 15:41:10 +00:00
Aske Simon Christensen aa85b09931 Remove broken generic supertype optimization.
The class hierarchy analysis maintains, for each class, a map from raw
supertypes to actual, parameterized supertypes. As an optimization, it
can share these maps between a class and one of its subclasses.

However, the sharing/copying mechanism sometimes ends up with entries
in the map that should not have been there.

This commit removes the optimization and always uses a separate map
for each class.

Closes https://github.com/dart-lang/sdk/issues/31996

Change-Id: I4c641d9c7d15706035791dd2b586a24045afceaa
Reviewed-on: https://dart-review.googlesource.com/39765
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-02-09 09:39:07 +00:00
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
Dan Rubel d4f2f9cef2 Update fasta parser to report constructor initializer errors
This CL updates the fasta parser to report three additional
errors in constructor initializers:

* ExpectedAnInitializer
* MissingAssignmentInInitializer
* RedirectingConstructorWithBody

I also added a comment from a discussion about
https://dart-review.googlesource.com/c/sdk/+/39320

Change-Id: Iecb6fe97e3612a11ccc89864a4fc9f353846504c
Reviewed-on: https://dart-review.googlesource.com/40040
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-02-08 18:08:40 +00:00
Paul Berry 2f8b0ff200 Remove unused import
Change-Id: I60a43113afcff04eedf3cab44223ce180fd77e97
Reviewed-on: https://dart-review.googlesource.com/39902
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-08 15:52:11 +00:00
Brian Wilkerson 5ceaa66dfa Add more recovery tests gleaned from issues
Change-Id: Ib2e366353a9601802bbf9e690b2fad55ccef7fc9
Reviewed-on: https://dart-review.googlesource.com/39882
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-08 14:21:51 +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
Brian Wilkerson 217110c2db Use TypedLiteralNode.isConst in more places and fix a bug to improve the optional new/const support
Change-Id: I2839b0c269796fedb7a3e7340388bb3576ac6b59
Reviewed-on: https://dart-review.googlesource.com/39424
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
2018-02-07 17:00:51 +00:00
Paul Berry f299f2d00f Remove error code TOP_LEVEL_TYPE_ARGUMENTS, which is no longer used
Change-Id: Ic41373617a5c96906840ac49bc13825323b486c6
Reviewed-on: https://dart-review.googlesource.com/39560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-07 14:41:42 +00:00
Paul Berry d9d2dc405b Infer mixin types in the analyzer.
This follows Leaf's simplified suggestion.  As a temporary hack it
assumes that the mixin passes its type parameters through to its
superclass constraint unchanged.

Change-Id: I091b44005d6364a91e20578f2ff6340334b1fab6
Reviewed-on: https://dart-review.googlesource.com/38040
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-02-07 10:45:39 +00:00
Lasse R.H. Nielsen 6f78471687 New methods on Iterable, List, Set, Queue, Map.
Changes signature of Iterable.singleWhere.
Makes LinkedHashMap no longer be a HashMap.

Change-Id: I7a12fea533d42b0fc8357086649df38ad01f3cdd
Reviewed-on: https://dart-review.googlesource.com/39140
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-02-07 06:12:53 +00:00
Dan Rubel b2c5415db9 Rework parseClassMember to remove findMemberName
This CL finishes the process of removing findMemberName from parsing
class members and sets the stage for improved recovery.
In addition, this CL:

* Revises the `endMethod` event to include a beforeParam token
    so that the parser can revise the token stream before the parameters
    during recovery.

* Reworks insertSyntheticIdentifer for use in more places

Change-Id: If5bcd6f554053f72429e938b5cd5e7021e03d5b3
Reviewed-on: https://dart-review.googlesource.com/39320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-02-06 21:01:53 +00:00
Dan Rubel e1e7ab1c3d Fasta parser cleanup
This separates and cleans up externally called fasta parser methods
such as parseTopLevelMember and parseMember from internal callers.

* Split external and internal calls to parseTopLevelMember
    so that external callers use parseTopLevelMember
    and internal callers use parseTopLevelMemberImpl.

* Rename the externally called parseMember --> parseClassMember
    and the internally called parseClassMember --> parseClassMemberImpl

* Revise the insertSyntheticIdentifier method and cleanup some
    exiting recovery code to use it.

Change-Id: Ic66ddcbbe761937bb917c679590fc7de2fdd0396
Reviewed-on: https://dart-review.googlesource.com/39080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-02-06 16:34:43 +00:00
Brian Wilkerson a0cfe5aa65 Fix more issues related to optional new and const
Change-Id: I0c1302c9b0505694853175f2b756c134e0caba19
Reviewed-on: https://dart-review.googlesource.com/38900
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
2018-02-06 16:10:53 +00:00
William Hesse 9c35cff5cd Revert "New methods on Iterable, List, Set, Queue, Map."
This reverts commit 0b59f24f97.

Reason for revert: Creates crashes in dart2js with kernel, see
https://luci-milo.appspot.com/buildbot/client.dart/dart2js-linux-d8-minified-1-5-be/9751

Original change's description:
> New methods on Iterable, List, Set, Queue, Map.
> Changes signature of Iterable.singleWhere.
> Makes LinkedHashMap no longer be a HashMap.
> 
> Change-Id: Ibd7e56e1ac03cb9fb10d19d1328d452fcd06d89f
> Reviewed-on: https://dart-review.googlesource.com/32541
> Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>

TBR=lrn@google.com,leafp@google.com

Change-Id: Iab904f5885a5213ae2e16ef496eed0b6843185f3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/39060
Reviewed-by: William Hesse <whesse@google.com>
2018-02-06 13:32:19 +00:00
Lasse R.H. Nielsen 0b59f24f97 New methods on Iterable, List, Set, Queue, Map.
Changes signature of Iterable.singleWhere.
Makes LinkedHashMap no longer be a HashMap.

Change-Id: Ibd7e56e1ac03cb9fb10d19d1328d452fcd06d89f
Reviewed-on: https://dart-review.googlesource.com/32541
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-02-06 11:17:46 +00:00
Aske Simon Christensen 402e69b53d Allow setters to have the same name as the enclosing class.
Closes https://github.com/dart-lang/sdk/issues/30834

Change-Id: Ic59222a2eda29b283b1572b47ef9c780e3bd11c3
Reviewed-on: https://dart-review.googlesource.com/34120
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-02-06 10:54:26 +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
Konstantin Shcheglov 76dfc549d5 Remove overrides for tests that don't fail anymore.
https://dart-review.googlesource.com/c/sdk/+/35660 fixed several tests.

R=brianwilkerson@google.com

Change-Id: I8f8504ad5024cbc0fab7148401662a3592bcec7b
Reviewed-on: https://dart-review.googlesource.com/37361
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-05 22:22:55 +00:00
Konstantin Shcheglov c16575c1f2 Issue 30884. Index MethodInvocation type arguments.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/30884
Change-Id: I0597d56d72fbff804ecf1a2f435815d02678eba6
Reviewed-on: https://dart-review.googlesource.com/38784
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-05 19:34:46 +00:00
Brian Wilkerson 3226cc781e Remove test missed in a previous CL
Change-Id: I253b2c08b071b44f34878f0162b800da5c431ec2
Reviewed-on: https://dart-review.googlesource.com/38783
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-05 19:30:36 +00:00
Brian Wilkerson 6b23aec701 Correctly resolve constructors in generic classes
Change-Id: I88a30b151b3177d6ae628c50bb51aceb48a70e7a
Reviewed-on: https://dart-review.googlesource.com/38780
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-05 19:19:37 +00:00