Commit Graph

217 Commits

Author SHA1 Message Date
Konstantin Shcheglov fa3a4eb956 Update TOP_MERGE according to the spec change.
Bug: https://github.com/dart-lang/sdk/issues/41412
Change-Id: If61638188e594cb1b4272e0011ff0ebd5dbb2772
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142942
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-09 16:28:09 +00:00
Konstantin Shcheglov dcdc71d763 Report CONFLICTING_GENERIC_INTERFACES using ClassHierarchy.
Change-Id: Ib5d79403358efffd5365ac4931c3163d746d933a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142567
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-07 15:50:28 +00:00
Johnni Winther 46bb15edf3 [cfe] Fix inheritance test data discrepancies.
Change-Id: I367aace60324a7755f795d2f24aaf0d138bc8d59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141602
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-04-02 13:14:39 +00:00
Johnni Winther d68f552e70 [analyzer,cfe] Handle (un)assigned state in try-statement
This handles (un)assigned state in try-statement that do not
complete normally. In this case we could create a variable model
for an unreachable state that would be both assigned and unassigned
leading to an assertion failure.

Closes #41284

Change-Id: Id4c7689bc7c614338af3542eb342c964696fca1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141981
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-04-01 15:46:15 +00:00
Konstantin Shcheglov c957128c7e Document differences in inheritance tests between CFE and analyzer.
Change-Id: I812a268990f8db844b03f06545804ce60e7164e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141380
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-03-30 17:34:08 +00:00
Konstantin Shcheglov 8120ee57d2 Merge types during instance member inference.
Change-Id: If3f252d1c031fcb5219e485ac7a053186e6b950c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141207
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-03-27 16:22:26 +00:00
Konstantin Shcheglov 216d98ad2c Use NNBD_TOP_MERGE to combine signatures of the inherited members.
Initial: https://dart-review.googlesource.com/c/sdk/+/133041
Reverted: https://dart-review.googlesource.com/c/sdk/+/133086

Instance inference is not supported yet in this CL, will continue
in following CLs.

Change-Id: I72de01180b0624eeafc03bfe415ed3d928f1110f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133167
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-03-26 21:13:12 +00:00
Johnni Winther 62f84880ef [cfe] Report error on missing return from non-nullable function
Closes #40520
Closes #40948
Closes #40425

Change-Id: I0aa3cfa51b410c90dd0bea963846eeb6b2e73efb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140540
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-03-24 08:21:36 +00:00
Johnni Winther 9605fc367f [cfe] Report error on required named parameters overriding optional named parameters
Closes #40950

Change-Id: I5d829affd3df9ca66d5a1b632f364779bdcfb2ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140541
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-03-24 06:22:16 +00:00
Konstantin Shcheglov 5e4f28b900 Use ClassHierarchy for computing implemented interfaces.
Change-Id: Ie7acf61f9a29d59cc1416dea85a6adb7c534b8c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140703
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-03-23 22:00:37 +00:00
Konstantin Shcheglov 6b7d7aa2c1 Type Function should be excluded from extended / implemented / mixed types.
Change-Id: If225400a976657f042856bfdaf95b285f98cebb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-03-23 20:35:37 +00:00
Johnni Winther 0e75a0650f [cfe] Handle mixing in Function
Closes #35477
Closes #35573

Change-Id: I0612641108caf1fa08da1aae7684e7f33dfe3b46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140402
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-03-23 09:56:30 +00:00
Konstantin Shcheglov bdf1454357 Consider FunctionType(s) with required named parameters as subtypes of legacy FunctionType(s) with named parameters.
Change-Id: Ic2f6b0226ec7885e45ef54053b95b84d3bbf8201
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140181
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-03-21 21:51:36 +00:00
Johnni Winther eb4880beca [cfe] Don't include Function in Class.supertype and Class.implementedTypes
Change-Id: Ib510080a331915a66a0ca51507f8f2bcd29940c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140042
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-03-20 16:48:09 +00:00
Johnni Winther 6dff390dec [cfe] Compute consolidated supertypes
Change-Id: Ifa2303afd61af184b171f13f5959b0786273cedb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140041
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-03-19 15:26:09 +00:00
Dmitry Stefantsov 3b6935f30e [cfe] Report NNBD warnings as errors in strong mode
Closes #40981.

Bug: https://github.com/dart-lang/sdk/issues/40981
Change-Id: I95715ab973a6f09bf7f8b4e090e5a80663cd4861
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139463
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-03-19 11:26:39 +00:00
Konstantin Shcheglov 4844fa9622 Issue 40959. Support null-shorting for cascades.
Bug: https://github.com/dart-lang/sdk/issues/40959
Change-Id: Ia7fd153debafd13ab469bbfcc3a2d1ef3feaa5f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139865
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-03-18 07:36:36 +00:00
Johnni Winther 6c6144bb74 [cfe] Implement consolidated in ClassHierarchyBuilder
Closes #40414 and #40156



Change-Id: I066aa8ceef4f998230215fd9e9b446b2281cc3bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138294
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-03-13 08:16:49 +00:00
Konstantin Shcheglov 17eec5bcde Mark variables written anywhere as not definitely unassigned.
Change-Id: Ia3fa8050eca7c7523500cb63620489cecb15f6d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139038
Reviewed-by: Paul Berry <paulberry@google.com>
2020-03-11 19:47:44 +00:00
Konstantin Shcheglov 9a0c09ecb2 Track definitely unassigned variables.
Change-Id: Id610a133912605f9af63222f25408942420cbf1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138881
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-03-10 18:35:40 +00:00
Konstantin Shcheglov 24c8021f03 Replace initialize() with declare().
Fixes https://github.com/dart-lang/sdk/issues/38791

Change-Id: I954059160c75de91e1e32fe2f82ebfdc5569d947
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138666
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-03-09 18:24:51 +00:00
Johnni Winther 101588f0f4 [cfe] Implement legacy top merge functionality
+ fix getter/setter type inference

Change-Id: I9a4bed2b6a53131cbc9946bac0a01a4b15a63a91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137922
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-03-03 12:19:09 +00:00
Johnni Winther fbe9f6115d [cfe] Handle Object* in NNBD_TOP_MERGE
Closes #40481

Change-Id: I5f1060b137e9855106873b2173930d3ebed69930
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137921
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-03-02 12:15:50 +00:00
Johnni Winther 5800997ed7 [cfe] Correctly merge nnbd signatures
Change-Id: I33e55f6ba4c2822c790667a06e0456410696ca04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137920
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-03-02 12:15:50 +00:00
Johnni Winther a9162bd599 [analyzer,cfe] Implement mixed inheritance id test for analyzer
Change-Id: Ie4ce09b83c2a96a5ad16c60d2924f18cd90a4089
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136633
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-24 13:28:26 +00:00
Johnni Winther 5829fc7829 [analyzer,cfe,dart2js] Add marker.options files to automate running id tests on all configurations
Change-Id: Ib5eb7f3967634721047f8dcc57b9e6c350b91a41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136226
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-21 08:34:26 +00:00
Johnni Winther 6adbaacca3 [cfe] Add test for issue40524
Change-Id: Ic061bf901752ff1e776a8a3c6933128fadff2da0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136130
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-18 12:56:09 +00:00
Johnni Winther a350984b65 [cfe] Add inheritance tests for reported problems
Change-Id: I2dfc46f718e7609f3626040eb3542b5441574975
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135907
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-18 12:00:29 +00:00
Johnni Winther 514a754150 [cfe] Add ClassMember.isProperty
Change-Id: I08e38f706f4606e80b607f180443924c85ee4b2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135905
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-18 11:05:04 +00:00
Mayank Patke 1591ddcf1e [dart2js] Normalize DartTypes.
Change-Id: I2c3ddbecf9f9bbaac8f940398a7d5949c441fca4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134941
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-14 01:59:12 +00:00
Johnni Winther ed2df21191 [cfe] Decouple MemberBuilder from ClassMember
Change-Id: Ia9d3a3ffa51781cfef1af0451902fe97620d2517
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135303
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-02-12 09:57:55 +00:00
Dmitry Stefantsov fd992e423e [cfe] Normalize supertypes before nnbd-top-merging them
Closes #40454.

Bug: http://dartbug.com/40454
Change-Id: Ia255c99c937a04876e04a0f0f5935147e55fbd35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134842
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-07 18:14:40 +00:00
Johnni Winther 0fe2779149 [cfe] Don't check override for member signatures.
Closes #40460

Change-Id: If418c0c809ec15febfa63c5363f8353cb16fc9de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134521
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-06 08:59:31 +00:00
Mayank Patke 450924a8cd [dart2js] Remove typedefs from backend.
Change-Id: Ia170535b5d35d97003cff93acbf33cb3fe75725f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134206
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-02-05 01:09:47 +00:00
Johnni Winther 178384832c [cfe] Handle unresolved superclass on opt-out class with opt-in platform
Closes #40366

Change-Id: I3452cc825df52009cb294102d99de06c168413f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133782
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-31 08:27:21 +00:00
Johnni Winther 5fb7223b9a [cfe] Handle parameter type inference for mixed inheritance
Closes #39207

Change-Id: Idaac1dcf6980fdebff326002adc466cb06fd0c91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133781
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-30 14:26:38 +00:00
Johnni Winther 7248e98023 [cfe] Support nnbd platform without experiment enabled
All handling of the opt-out features were guarded by the experimental flag.
With this CL the opt-out semantics is used irregardless of the
the experimental flag. This supports compiling with opt-out semantics
against libraries which have been compiled with the flag enabled, as will
be the case when the nnbd sdk is unforked.

Closes #40334

Change-Id: I2df5c700f97844bdd3e33bccba7e72013f0c831e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133780
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-30 12:56:26 +00:00
Johnni Winther 5b47e0fbb7 [cfe] Special case inference of Object.== parameter in legacy mode
Closes #40334

Change-Id: I526ff75a2f135d911f8d555804d03cddc98c3bc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133234
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-28 13:17:37 +00:00
Paul Berry 0399fcf6fa Flow analysis: fix shared tests to consider potential nullability instead of nullability.
No change in functionality.  Just changing the analyzer's
nullability_test.dart so that it generates the `nonNullable`
annotation for a promotion from type parameter `E` to `E&Object`.
This makes it consistent with the front end test runner behavior.

Change-Id: I9b74222257b432e361fbe46aa7d4d7070225a5e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133322
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-27 12:43:06 +00:00
Johnni Winther bbe5599476 [cfe] Handle promotion of nullable type variables
Change-Id: I5a58cf318bce5bc5342ac6d9f4d197d4e2f46680
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133225
Reviewed-by: Paul Berry <paulberry@google.com>
2020-01-27 12:43:06 +00:00
Johnni Winther 0a771440dd [cfe] Using isSameType in override checking of bounds
Closes #40220

Change-Id: I2008bcd4c96fb05efad4bd446215cd5710731fce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132846
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-01-24 12:41:19 +00:00
Johnni Winther 4ad57412bb [cfe] Use legacy erasure and nnbd top merge in computation of supertypes in ClassHierarchyBuilder
Closes #40134

Change-Id: I50e6f4c6fe7b1e0fa7f3e0e609e015f630cff1b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132343
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-01-22 08:37:36 +00:00
Johnni Winther 5e389080a4 [cfe] Test supertypes computed from ClassHierarchyBuilder
Change-Id: Ia079754bd8272d7b5689a3bdab1e69d5188082be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132342
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-22 07:08:36 +00:00
Konstantin Shcheglov 020585872a Intersect promoted types in joinV().
Bug: https://github.com/dart-lang/sdk/issues/40010
Change-Id: I02299e48ab1c9305a2d29f804796182444f3d9aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132166
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-01-17 22:31:37 +00:00
Konstantin Shcheglov 58a65fe4ba Issue 40110. Update switchStatement_end() to 'isExhaustive', use for switch on enum in analyzer.
Bug: https://github.com/dart-lang/sdk/issues/40110
Change-Id: Ic17ab4562f518b7e69b78c3285b577ea3b8d1223
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131712
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-01-17 22:07:16 +00:00
Johnni Winther d302d7f10a [cfe] Insert member signatures for nnbd aware inheritance
Change-Id: I86dbbd586434af81b6dc4f4ae748cbd8177d06e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129080
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-01-15 07:36:28 +00:00
Johnni Winther 84c2a50aa0 [analyzer,cfe,dart2js] An indices to annotations preserve original order in id_generation
Change-Id: I0894baa6771b1c5a11a33007feebd1886aea032d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130704
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-01-10 11:51:17 +00:00
Johnni Winther c1dc711ee7 [analyzer,cfe,dart2js] Use id_generation to show annotation diff
Change-Id: I1f1d96b3be023e9e9cfa25425f57a540edad6f6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130703
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-01-10 11:51:17 +00:00
Paul Berry b6ab691389 Flow analysis: adjust nomenclature to match spec draft.
Two renames, to make the implementation more closely match
https://github.com/dart-lang/language/pull/763:

- typesOfInterest -> tested
- promotion chain -> promoted types

Change-Id: If2c0d72c81bee45ef94fc4fb04000f5c9ed84f26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130570
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-01-08 17:28:15 +00:00
Paul Berry 721670fc2d Stop using package:expect in _fe_analyzer_shared.
_fe_analyzer_shared is published on pub so it isn't appropriate for it
to use package:expect (which isn't published at all).  All we were
using it for was a few string equality checks; simply using operator==
and throwing an exception is an adequate replacement.

If, in the future, we decide that we really need the additional
functionality provided by package:expect, we can always convert the
test to use package:test, and then make use of the `expect` method
provided by package:test.

Partially addresses https://github.com/dart-lang/sdk/issues/40007.

Change-Id: Ib7827db0cdb480feacc454a3aa660ea4c6e7cfd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130623
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-01-08 16:28:50 +00:00