Commit Graph

32 Commits

Author SHA1 Message Date
Mike Fairhurst 1d59ab22ce Fix #29014, make function type parameters invariant.
With the restricted behavior, some tests have been removed, modified,
and added based on the new invariance.

Bug: 29014
Change-Id: I086749bbe40aaa723009f9ae06f58d85554cae53
Reviewed-on: https://dart-review.googlesource.com/56029
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-05-24 07:56:29 +00:00
Mike Fairhurst ebcd876d0c Remove broken overrides
Change-Id: I7815fb1a139bf4723e29177965cfde8942ef2d3e
Reviewed-on: https://dart-review.googlesource.com/52264
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-20 22:04:26 +00:00
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
Aske Simon Christensen 2183869465 Treat invocations on dynamic as unknown, except for return type of ==
Closes https://github.com/dart-lang/sdk/issues/32173

Change-Id: I77bd06f292a701f1b51d4077f31439598a7b4683
Reviewed-on: https://dart-review.googlesource.com/41762
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-02-20 16:42:25 +00:00
Mike Fairhurst cb7e85a26d Support void as a Top type, with as few other changes as possible.
Change-Id: Ife337e28fa86f9b98cdabf48a01a4e2f608aa4b8
Reviewed-on: https://dart-review.googlesource.com/35520
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-01-26 22:42:08 +00:00
Paul Berry 1891084dec Generate fresh type parameters prior to inferring an invocation.
This is necessary to avoid confusion when a generic function or method
recursively calls itself.

Fixes #31759.

Change-Id: I4e3be2093e9d6b81f084250435ea7493ca6b2464
Reviewed-on: https://dart-review.googlesource.com/36363
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-24 19:41:58 +00:00
Dmitry Stefantsov 10058a3600 Use instantiate to bound in body builder of fasta
Change-Id: I6e3d9f60c43ccb34df0b58c635be51ea0aa2e789
Reviewed-on: https://dart-review.googlesource.com/32600
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-01-15 14:56:41 +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 a8ebc3115c Use the same rule for inference in expression function bodies as in block bodies.
Bug: https://github.com/dart-lang/sdk/issues/31436
Change-Id: I535c39383d42862f035b54e2fb5c143367605697
     https://github.com/dart-lang/sdk/issues/31638
Reviewed-on: https://dart-review.googlesource.com/32860
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-01-07 20:46:31 +00:00
Dmitry Stefantsov 1f3b493dcc Add simple instantiate-to-bounds algorithm to the common front-end
Bug:
Change-Id: I65097b037f4b02f0a161c9c183844a3dc3339c77
Reviewed-on: https://dart-review.googlesource.com/29880
Reviewed-by: Paul Berry <paulberry@google.com>
2018-01-04 11:31:08 +00:00
Brian Wilkerson aa593d0a2a Deal with a flaky test
Change-Id: I1d9e2616ce896b100ddfd9490c63db391d7debae
Reviewed-on: https://dart-review.googlesource.com/32180
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-01-03 21:11:44 +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
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 b8ff3ae081 Record invocation type arguments, and apply to explicit nodes.
R=brianwilkerson@google.com, paulberry@google.com

Bug:
Change-Id: Iccd71aafb4baa2c384e43511527f503003ea7e85
Reviewed-on: https://dart-review.googlesource.com/31760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-12-29 20:31:05 +00:00
Konstantin Shcheglov fa6f91999c Resynthetize FunctionType(s) with synthetic element.
Use actual element for typedef(s).

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

Bug:
Change-Id: I01163de0a8a3c776e8bdd1bd0973962e687cfbac
Reviewed-on: https://dart-review.googlesource.com/31580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-12-28 20:47:26 +00:00
Brian Wilkerson f52274630e Disable a flaky test until it can be investigated
Change-Id: Icabacb7c41fe7727757989e3508dc707a8ddb792
Reviewed-on: https://dart-review.googlesource.com/30466
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-12-19 19:40:43 +00:00
Paul Berry ae9b0c42d7 Add type inference code to generate Instantiation nodes.
Fixes #31586.

Note that none of the back-ends handle Instantiation nodes yet, so the
language_2 tests added in this CL
(instantiate_tearoff_after_contravariance_check_test,
instantiate_tearoff_of_call_test, and instantiate_tearoff_test) fail
pretty much across the board right now.

Includes two fixes to Instantiation.getStaticType and the kernel type checker:

- Previously, they attempted to perform substitution on the full
  function type, which had no effect because the type parameters were
  bound.

- The type checker was not checking that type parameter bounds were
  satisfied.

Note that the front end doesn't yet check that type parameter bounds
are satisfied by the inferred type parameters.  I will address that in
a follow-up CL.

Change-Id: Ib0ad7a5fc5f4a2fdc8c99abe1f2d3d15b21a4974
Reviewed-on: https://dart-review.googlesource.com/29744
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-12-15 20:41:43 +00:00
Brian Wilkerson 77d3b70220 Add previewDart2 to remaining kernel tests
Change-Id: I097df911af5d90f38eb177a6744c798a29a5804e
Reviewed-on: https://dart-review.googlesource.com/29460
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-12-13 22:46:14 +00:00
Konstantin Shcheglov 26d0486de2 Fix serializing metadata when using LimitedBinaryPrinter.
TBR

This also fixes a race condition on Windows, where we sometimes
consume not serialized/deserialized Kernel.

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

Bug:
Change-Id: Ie40534d2562e75c05618e9ccb4fb86fc499184ff
Reviewed-on: https://dart-review.googlesource.com/14260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-10-16 21:57:39 +00:00
Brian Wilkerson 2aa005b11b Improved handling of semicolons
Change-Id: I85c42387bad18149bd2fb7718f6d40b82a95562f
Reviewed-on: https://dart-review.googlesource.com/13626
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-13 16:16:43 +00:00
Konstantin Shcheglov 815737113d Triage StrongModeLocalInferenceTest_Kernel and StrongModeStaticTypeAnalyzer2Test_Kernel.
R=brianwilkerson@google.com

Bug:
Change-Id: I5589eedbbbf53b9e09c10284ebdec20c4e76eccd
Reviewed-on: https://dart-review.googlesource.com/13104
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-11 19:41:09 +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 5e5d4e0e51 Frontend does support generic function typed formal parameters.
So, we don't need the workaround in DeclarationResolver, and we
don't need to mark corresponding tests as failing for *_Kernel tests,
so we stop inheriting *_Driver for these tests and provide
enableNewAnalysisDriver explicitly.

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

Bug:
Change-Id: Ib09f7bc5be5f4a80ba7874791b5b3f28a4d0a23c
Reviewed-on: https://dart-review.googlesource.com/12742
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-10 20:31:28 +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 d4dec4e1a4 Create GenericTypeAliasElement for both FunctionTypeAlias and GenericTypeAlias nodes.
Some pain points are:

1. It is a breaking change. I think I will break it even more by removing
   FunctionTypeAliasElement altogether.

2. We lose ability to keep track that this FunctionType is instantiation
   of a typedef. Just like in Kernel.

3. We sometimes have to look up to see if the GenericFunctionTypeElement
   is a function in a named GenericTypeAliasElement.

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

Bug:
Change-Id: Ib250cc446a0ed5b8969f16f7cc6293ef4acf01a8
Reviewed-on: https://dart-review.googlesource.com/9421
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-29 00:39:05 +00:00
Konstantin Shcheglov fb02cf80ee Constructors should not have type parameters when resynthesize from Kernel.
Factory constructors are represented as static Procedure(s) with
type parameters. This does not match to the language specification and
Analyzer element model. We need to pretend that these type parameters
are absent, so that we pick up the same named type parameters from the
enclosing class.

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

Bug:
Change-Id: Id26cf0e9c08699ac46978e14640e01089a1efcbc
Reviewed-on: https://dart-review.googlesource.com/9080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-27 23:55:42 +00:00
Konstantin Shcheglov f7dfecf118 Replace generic comments in analyzer's MockSdk with the real generic syntax.
Actual SDK already uses generic syntax.
This also fixes some failures in Kernel tests :-)

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

Bug:
Change-Id: Ie9bd5a058150522210671feb7009c233f5240add
Reviewed-on: https://dart-review.googlesource.com/8706
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-09-26 21:39:57 +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