Commit Graph

350 Commits

Author SHA1 Message Date
Jens Johansen 7ac22948e5 [CFE] More error for type variable in static contexts
Bug: 40918
Change-Id: Ibd7efa6618ea732a42bfb0042d5e9ef9bc8c0d8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138803
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-03-10 13:26:30 +00:00
Jens Johansen f828f00b59 [parser] Error recovery of type parameters on void
Fixes #39958.

Change-Id: I851bef762776f4b68f0fcb645d634019b8b32e81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137925
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-03-04 14:02:35 +00:00
Dmitry Stefantsov 0738b6701d [cfe] Allow nullable right-hand side in typedefs
Closes #40714

Bug: https://github.com/dart-lang/sdk/issues/40714
Change-Id: I4d9b4a9c1439415a8b16f5ac18046aacb56585de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138087
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-03-04 10:22:18 +00:00
Johnni Winther 3d5fb65c06 [cfe] Handle implicit extension method call in argument replacement
Closes #40816

Change-Id: I1d7e0c479e03e2b40010551ebeb977e12cdf250c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138082
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-03-04 07:26:13 +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
Dmitry Stefantsov c07d5d84b8 [cfe] Allow uninitialized non-nullable late fields
Change-Id: If0d1450c317b488e3299cfa031ab1a3d6953a7ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137787
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-03-03 09:50:27 +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 51bc38f26c [cfe] Fix uri in nnbd error
+ add support for configurations in messages tests

Closes #40789

Change-Id: I00b241df0e090a4736974e12598085d902ae9c77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137560
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-27 11:38:07 +00:00
Johnni Winther 4189237330 [cfe] Avoid crash on Never as bound
Change-Id: Ia7dc56774599a17d4a29d03ec8ec07cb01995fdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137300
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-02-26 10:19:07 +00:00
Johnni Winther 60582b3d7a [cfe] Handle future or fields
Change-Id: Ie915ca0824f983966e5017e899a02d50ad14b091
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136978
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-02-26 09:53:30 +00:00
Johnni Winther 53c59d9f4e [cfe] Fix uri in non-nullable field error reporting
Change-Id: I5af35ad08a26f4aaf780573ddbbb878ef75472f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136977
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-26 08:07:41 +00:00
Dmitry Stefantsov 5f41447fd3 [cfe] Reintroduce UnknownType to the subtype relation
Closes #40744

Bug: http://dartbug.com/40744
Change-Id: Iec3374cbcaac163f2aa599eb8f44fcd5b1cbd3c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136975
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-02-25 14:20:51 +00:00
Johnni Winther 2ce1df7630 [cfe] Handle compilation from agnostic dill
Change-Id: Iecf2fda94ba1029931151b0d45d013da065859d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136965
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-25 12:10:20 +00:00
Johnni Winther a4637db473 [cfe] Add expectation file test for issue 40662
Change-Id: Ibc774fa2a977258b45082ae5cae5fb7cfcde28bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136968
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-25 11:37:52 +00:00
Johnni Winther 1e7669885d [cfe] Handle late lowering field type inference
Closes #40581

Change-Id: I50f5ad10e4b37ad58b5c9ad05e593572857d1351
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136636
Reviewed-by: Jens Johansen <jensj@google.com>
2020-02-24 13:29:25 +00:00
Johnni Winther aa31a9162b [cfe] Support constant evaluation in agnostic mode
Change-Id: Ia33ea19a091b1172eb9b4125f5f30a625886d34e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136632
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-02-24 13:29:05 +00:00
Johnni Winther e6d1762ff2 [cfe] Add test for issue 40512
Change-Id: I85eed2287a4df8c38035cf79847753f1ce8a032b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136189
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-20 10:27:58 +00:00
Dmitry Stefantsov 0f141be8bd [cfe] Implement new rules around types of case expressions
Bug: http://dartbug.com/40425
Change-Id: I1f6e93bde663ab6f1a6a63e91aef4133af6e5253
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136186
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-19 13:32:10 +00:00
Johnni Winther 17d8b6b015 [cfe] Do not hoist this expressions
Change-Id: I3ffa0ad7c5c8e98a23c28281ac7840480fd366ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136223
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-02-19 11:31:59 +00:00
Dmitry Stefantsov 59045afd1d [cfe] Remove unnecesary uses of SubtypeCheckMode.ignoreNullabilities
Change-Id: I8b64ca39e7a153141885d428fc5bd95e446fcb49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135640
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-18 12:28: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
Johnni Winther b20c35c7d9 [cfe] Handle typed variable declarations during top-level inference
Fixes https://github.com/flutter/flutter/issues/50908

Change-Id: Ia7a04351eb9f2a557bb70c96c7938a28c8cbc835
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136127
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-17 15:00:05 +00:00
Johnni Winther a9485e8b14 [cfe] Encode getter/field invocation as .call on property get
Current semantics with respect to evaluation order is retained.

Change-Id: I6794c8a720237536696afab2fe056042f8464ec8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129702
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-17 13:52:45 +00:00
Dmitry Stefantsov d2d00ff357 [cfe] Allow unassigned late local variables
This is a partial fix for http://dartbug.com/40601.  It will be followed
by a CL disallowing definitely unassigned late local variables.

Bug: http://dartbug.com/40601
Change-Id: I2cdf95f8cc1cc6fbbb6a5de8d6fa0aa53c6e477d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135309
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-17 11:31:15 +00:00
Dmitry Stefantsov ce6f19da80 [cfe] Implement NNBD changes for falling over in case blocks
Bug: http://dartbug.com/40425
Change-Id: I640891b24ddaaceafe84460ea7396095ab42a0db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135647
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-02-17 10:53:25 +00:00
Dmitry Stefantsov d22c695e89 [cfe] Fix isSubtypeOf for cases like FutureOr<FutureOr<X%>>
Closes #40600.

Bug: http://dartbug.com/40600
Change-Id: Iff1fbc7f4f499bc2ba154d5fe43494dae0511f94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135315
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-17 10:44:35 +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
Johnni Winther 776b984115 [cfe] Correctly register parameters as initialized
Change-Id: I43fe9d251a5b79f909dbfb7689f0a37faee0c54c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135307
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-02-12 08:18:25 +00:00
Dmitry Stefantsov 2145850d40 [cfe] Check bounds for mutual subtyping in generic method overrides
Closes #40479

Bug: http://dartbug.com/40479
Change-Id: Ie98c4d316caa14ab51d838a05b1a2167024ce372
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135061
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-02-11 13:18:41 +00:00
Johnni Winther 8d9cbaf4c4 [kernel] Allow invalid types in naive_type_checker
Change-Id: I9a7614056fa3a14a382e41ad1e927f023fe00250
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134726
Reviewed-by: Jens Johansen <jensj@google.com>
2020-02-07 21:14:37 +00:00
Johnni Winther 4267085fa5 [cfe] Handle opt-out Null override of opt-in Never
Closes #40387
Closes #40420

Change-Id: I2f0810cadcba5f74bdd5a47060ffb14dc8fe7f07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134702
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-02-07 10:02:05 +00:00
Johnni Winther b978cb1cb5 [cfe] Support inference of lowered late field types
Closes #40373

Change-Id: Iddccbbafabe457fc8391dec8927a0e4fb3f6649b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134523
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-02-07 09:44:05 +00:00
Johnni Winther e74c829499 [cfe] Add test for Never in opt-out code
Change-Id: I91683d57e25457e371aaf8f0bb0092426409186e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134526
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-02-06 13:25:51 +00:00
Johnni Winther 80dacdf3a0 [kernel] Add Class.hasConstConstructor and Member.isNonNullableByDefault predicates
Closes #40440

Change-Id: I2776c165d23e2aa2bf5d7515741bd0f0d067b26d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134292
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-02-06 12:27:37 +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
Dmitry Stefantsov 5f29d40b0f [cfe] Make context of the null-check operator nullable
Closes #37692.

Bug: http://dartbug.com/37692
Change-Id: I2301cf693dc82133681e3969211103bc57880d82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134330
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-05 14:40:39 +00:00
Dmitry Stefantsov 4389ffa9d2 [cfe] Allow member access on Never
Closes #40125.

Bug: http://dartbug.com/40125
Change-Id: I2dcb1bdc022990ba8c76c7798c4e6793c5c89108
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134326
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-05 12:32:09 +00:00
Johnni Winther d826ecc447 [cfe] Use inferred types on forwarding constructors
Closes #40428

Change-Id: I26bf1e21684605d85312c5e808191ad035eb574b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134289
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-05 12:26:49 +00:00
Johnni Winther 88635446ec [cfe] Implement weak mode constants semantics
Closes #40124

Change-Id: Ia54490d9f5162a27e52c4e9c4d74c5cfaa28472b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134284
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-05 07:07:07 +00:00
Jens Johansen f0d16c3c31 [CFE] Parser test for class called late and required
Bug: #40288.
Change-Id: I5be3b949c954e071db4ad5418d23f56fdeb711ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134281
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-04 13:45:31 +00:00
Dmitry Stefantsov 5a8a3ad809 [cfe] Disallow late final fields and const constructors
Closes #40091.

Bug: http://dartbug.com/40091
Change-Id: I9e858ba4de096d230c40c2ff4136b173e46251cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134283
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-04 11:22:11 +00:00
Dmitry Stefantsov 3183573a79 [cfe] Account for signatures when inserting noSuchMethod forwarders
It is possible for an abstract member to be overridden with another
abstract member with different signature (that has, for example, more
optional parameters).  In such cases, the noSuchMethod forwarders should
be generated for each distinct signature.

Closes #40248.

Bug: http://dartbug.com/40248
Change-Id: I7974415f0ecb78f05d7265ecf9d57cc0d38e6c41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132661
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-04 07:58:00 +00:00
Johnni Winther 4d32ec8d21 [cfe] Non-nullify legacy types in opt-in libraries
+ preserve promotion for synthetic variables.

Closes #40255

Change-Id: I2ebe43c31a05ff0121d971205bf8ff5f0e084113
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134161
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-03 14:52:55 +00:00
Johnni Winther 3210109ccf [cfe] Detects writes during initialization in late final field lowering
Closes #40219

Change-Id: I8519a35cef96262df0dc68101e43ec5ea8b9de3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133987
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-02-03 13:40:50 +00:00
Dmitry Stefantsov 5af05598eb [cfe] Disallow non-nullable fields without initializers
Closes #40081.

Bug: http://dartbug.com/40081
Change-Id: I4032af18164af05034c2706cba8f62be39c636c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133994
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-02-03 13:32:45 +00:00
Johnni Winther 905a380258 [cfe] Handle explicit extension operator access from dill.
Closes #39938

Change-Id: I9798e02c243c1edfbeb1e6f5bb5564bcf9e74a05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133996
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-02-03 12:54:15 +00:00
Johnni Winther 42246f7f96 [cfe,analyzer] Disallow type parameters on operator methods
This was never supported by the grammar but unfortunately allowed by
both the analyzer and the CFE.

Change-Id: Id669c934fe08eda41973d6d2cef8340da2e7d72c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133591
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-01-31 14:05:02 +00:00
Johnni Winther e0d8aa825a [cfe] Use fileUri in error reporting
+ add support for expectation testing of custom platform libraries

Change-Id: I1dfae23963ec25f2be11fad06c218e1c59fe181a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133920
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-01-31 13:46:22 +00:00
Dmitry Stefantsov 5e38b59740 [cfe] Don't allow implicit tear-offs of .call on nullable receivers
Closes #39710.

Bug: http://dartbug.com/39710
Change-Id: I3556fac1de1bd6874bbb052e05accebac9619c8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133982
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-31 09:39:21 +00:00
Johnni Winther e1e0ae5898 [cfe] Demote inferred declaration types
Change-Id: Ibe6709219bd8d9dff80ad260ff8f6025cd74111a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133588
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-30 10:03:25 +00:00