Commit Graph

350 Commits

Author SHA1 Message Date
Johnni Winther e7cf75328c [cfe] Update assert to handle extension reexport
Change-Id: Ia7ec03803d86cb69640805ccca1a4f785d0e30e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133238
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-01-28 12:29:57 +00:00
Jens Johansen d7eeaed5dc [CFE] Reproduction and workaround for crash when computing variance
Fixes https://github.com/flutter/flutter/issues/48804.

Change-Id: I3108d102b13cce06dd7582f1f2b8a16aeaa6a6f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131832
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-28 11:04:47 +00:00
Johnni Winther e4048261c2 [cfe] Compute correct type for read of late lowered variables
+ fix crash on null-aware function call.

Change-Id: Ie2eac4aa21ec615850352e6a5d1292e87f420c9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133102
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-24 12:41:19 +00:00
Johnni Winther 00dc17687a [cfe] Handle late variables in for loops
Closes #40093

Change-Id: I6ed558884f2cf6b10f2d011a80e3f3e15d64b00d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133068
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-01-24 12:41:19 +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
Jens Johansen 241d2c6cf5 [CFE] Strong test can have linked dependencies
Change-Id: Ia95789b658147f7e2676a9c92b6ba4a1c419395b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132642
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-01-23 09:37:37 +00:00
Johnni Winther 163fcf6d46 [cfe] Check null nullable accesses and include null in inferred type for null aware expressions
Closes #40205

Change-Id: I679b056a0c733e7bcaf3f79fd4b659fc6844c94c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132842
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-23 08:52:47 +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 47743990a1 [cfe] Provide file offset on StringConcatenation
Change-Id: I70d5f47fd118f9b40c01f0f71057bd8e244561d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132240
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-17 09:48:12 +00:00
Johnni Winther 249414d34a [cfe] Avoid crash on late field override
Change-Id: I588b5e608ac89482c1198354975a028b48db7071
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131800
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-15 14:03:04 +00:00
Johnni Winther fd5bf3ed6b [cfe] Add opt-out version of general testcases
Change-Id: Idf0ea17fdf16c465f32367067b3d77a2e9492367
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131077
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-01-15 11:42:29 +00:00
Dmitry Stefantsov d747c51d8f [cfe] Use nullable context on LHS of if-null expressions
This is a fix for CFE of the same issue as reported in
https://github.com/dart-lang/sdk/issues/39694

Change-Id: Ied7fb27c8074f4c4ddbac29c8470544e9f32712a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131065
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-15 10:53:04 +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
Dmitry Stefantsov 89a7dfb10e [cfe] Add more tests for compile-time errors related to Null Safety
Bug: http://dartbug.com/40054
Change-Id: Idcfaf9ef61d023f6e88507447459f21b6b324a3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131079
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-14 09:02:25 +00:00
Dmitry Stefantsov b473a6f8ba [cfe] Report errors on missing required named parameters at call sites
Bug: http://dartbug.com/39660
Change-Id: I16bdb5983921654c84fc2374ccb768b5a0f52050
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131061
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-10 12:33:57 +00:00
Dmitry Stefantsov bf9dc4251e [cfe] Fix type inference for ?? operator in Null Safety
Change-Id: I0abda65d66c7042258cb0adc78e169aa200359ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130705
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-09 14:54:16 +00:00
Dmitry Stefantsov 0081dfc706 [cfe] Report error on required named parameters having default values
Bug: http://dartbug.com/39660
Change-Id: I0230d5b9f0448964ba9ad83a7adf46acfee9edcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130372
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-01-08 09:17:09 +00:00
Johnni Winther 6128ffd579 [cfe] Handle type variables as mixin superclasses
Closes #39774

Change-Id: Id6a247a73322f8ab06df56ea3e8c68d4e6813092
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129283
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-12-20 15:37:00 +00:00
Kallen Tu aa6709974d [cfe] Fix inference for variant parameters leaking UnknownTypes.
Change-Id: I056535cbfc74554de408ce4f9d89c142c4c860cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128771
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2019-12-19 02:14:59 +00:00
Dmitry Stefantsov a7a73e23b4 [cfe] Report an error if thrown expression isn't assignable to Object
Closes #39659.

Bug: http://dartbug.com/39659
Change-Id: Ibf54cf25ed9593c33e3d6576bab345070bb44d6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128669
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-12-18 15:26:01 +00:00
Dmitry Stefantsov 01a8d76307 [cfe] Fix compiler crashes on for-in iterables with Null type
Closes #39817.

Bug: http://dartbug.com/39817
Change-Id: Id60a3d35d73880c68e6a73adffd4c8c96e9b49fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128664
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-12-18 15:14:21 +00:00
Dmitry Stefantsov 2af5aec84e [cfe] Infer type of x! as Never if x's type is Null
Closes #39822.

Bug: http://dartbug.com/39822
Change-Id: I9600efcd4e69e331de5d9fa8f2b676c402df6502
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128661
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-12-18 09:01:30 +00:00
Dmitry Stefantsov c85979a280 [cfe] Implement the NNBD variation of the assignability property
Change-Id: I802e5668952f918919bd4fda4fd0102623a20ae7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128544
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-12-16 12:38:27 +00:00
Johnni Winther f521734ce7 [cfe] Handle setter import conflicts
Fixes the underlying problem for the crash reported in
https://github.com/flutter/flutter/issues/46823

Change-Id: I392c7bae3679cae52b694f3bd08b0b700ee9c56f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128540
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-12-16 12:02:47 +00:00
Johnni Winther 818ec6db92 [cfe] Implement nnbd-top-merge
+ and use nnbd-top-merge and legacy erasure in hierarchy computation

Change-Id: I4bf06ce8d3c68a9926865ebf84b24b4029828d73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128065
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-12-13 17:19:59 +00:00
Johnni Winther a577d0aea5 [cfe] Add weak mode testing
Change-Id: I3670e77a205404c0b35ee551a18c6ebdc2ecab33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128069
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-12-13 09:20:08 +00:00
Johnni Winther 97c2ca5ff1 [cfe] Use valid static types and file offsets in collections transformation
Closes #39566

Change-Id: I589d0dd568b3ea939bb1238b1c61fca6867e737e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127320
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-12-06 10:58:20 +00:00
Jens Johansen 0dc6d59d52 [CFE] Fix crash caused by name clash of loadLibrary tearoff method
Fixes #39682

Change-Id: I0e326df9390e05ede939f0019e94f8abe1fb7983
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127460
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-12-06 09:29:19 +00:00
Johnni Winther 2ea8ff5ae7 [cfe] Don't continue shorting in explicit extension null aware access
Change-Id: Icd4ca31d4ca3c1601f190c3661cfd61b3f96db3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126735
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-12-04 09:24:49 +00:00
Johnni Winther 1454a67e09 [cfe] Don't use multiple null-aware guards in opt-out
Change-Id: I15bd991577ffcc309569ee4a5512dfb29c7874ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126732
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-12-02 12:19:27 +00:00
Johnni Winther 659b32ffc8 [cfe] Handle chained null shorting and null aware if-null set
Change-Id: I39d2448a957ca7f4f3d1f027e543f773b300ce9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126645
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-11-28 12:44:55 +00:00
Aske Simon Christensen 18f23124ad [cfe] Print nullability on types in messages for opt-in libraries.
This CL changes the message template generator to add an extra
'isNonNullableByDefault' parameter to 'withArguments' for all
messages that include types, thus forcing the reporter to specify
whether the library that the message belongs to is opted in to NNBD.

When the message is formatted, a '?' is added to all nullable types
if the message is reported for an opt-in library.

Change-Id: I4e1861eba48043c570afad3f40bc3dccfd2e5668
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124984
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-25 14:58:45 +00:00
Johnni Winther cb6ab6eaa2 [cfe] Handle untyped initializing formals for late fields
Change-Id: I7cd0612ea7690d1679fbd7269f628ec5bc65dd05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126040
Reviewed-by: Jens Johansen <jensj@google.com>
2019-11-25 13:59:25 +00:00
Johnni Winther 970c164826 [cfe] Use correct types in transformations and start verifying getStaticType
With this fix Expression.getStaticType no longer throws on any known cases.
Users of getStaticType can therefore avoid enclosing static type computation
in try-catch.

Closes #38597

Change-Id: I52eaacd30256333d7c368e5d14f4e4956bafc96f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121988
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-11-21 22:15:58 +00:00
Johnni Winther acff31ed26 [cfe] Support null-aware index access
Change-Id: I54b58624722845e4b008b90e675516ec274bc2da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125960
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-21 14:36:30 +00:00
Johnni Winther 4c8c44ec78 [cfe] Implement lowering for constructor initialization of late fields
Change-Id: Ia6187c3eac630a2bd4351868aadfaa8771648830
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125821
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-11-21 09:36:35 +00:00
Johnni Winther 246b23e5be [cfe] Implement late lowering for local variables.
Change-Id: I18f848561f7eca61f662f8083f7ca1451a8a0b3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125605
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-11-20 08:30:18 +00:00
Dmitry Stefantsov 203583b41b [cfe] Account for invalid type being part of a type in subtype check
Bug: http://dartbug.com/39421
Change-Id: I9d70f6722134ece7f567d0aab9b6a0d661ea650e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125268
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-11-19 09:42:03 +00:00
Johnni Winther 7c1f58f9fe [cfe] Demote inferred type variables when used as type arguments
Closes #39346

Change-Id: I997347d04e7a3c3cb9786f31cd6c24513307de92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125502
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-18 14:57:43 +00:00
Johnni Winther 9e03a639ea [cfe] Split inferMethodInvocation into invocation variants
Change-Id: I4ca0cb419652b4d822d8eb945a77b7243012ed1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125411
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-11-18 10:03:33 +00:00
Johnni Winther 09d75d94e7 [cfe] Avoid use of #isSet# field on non-nullabel late fields
Change-Id: I8dd77ee3eb1401ab29c87d303bdcface1d4d823e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124691
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-11-15 13:29:45 +00:00
Johnni Winther 45996ee170 [cfe] Add late field lowering for static/top-level fields
Change-Id: I16625257251b0badbcdfc1c9504899421db8b83f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124681
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-11-15 13:29:45 +00:00
Johnni Winther 6e85f3337a [cfe] Support null-aware cascade
Change-Id: I1db4125b4469e6a8b6adc5ec6e4dcafc0a26da4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124680
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-14 12:39:16 +00:00
Johnni Winther f443bc918e [cfe] Add tests for inheritance from opt-out libraries
Change-Id: If139945dfdd808da0c24ac550ecfa235b41d3c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123737
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-11-13 10:08:08 +00:00
Jens Johansen 48f0b83ff2 [CFE] Allow ! in cascade
Fixes #39286.

Change-Id: I4e7270dacf7bc43accae4d45d26146cfb7d2b1ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124330
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-11 09:44:12 +00:00
Johnni Winther 9c983d2ee3 [cfe] Support extensions via prefix
Change-Id: I6c1e69e5a5c83f5177754a350f5efbca9384972b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124540
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-11-08 19:53:00 +00:00
Johnni Winther fd9f79c25d [cfe] Handle deferred explicit extension access
Change-Id: I53e13ac3b4f1bdcd26ccec86814fb4d708c5cceb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124542
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-08 14:19:47 +00:00
Kallen Tu 54d7b0307b Refactor type_inference_engine and take type parameter variance into account for contra. checks.
This change will optimize code generation for contravariant checks on
variantly sound type parameters. We avoid emitting `_check()`s.

This will also add the change to ensure that reified types of torn off
methods are correct.

Change-Id: Ic7a4aa8f92b5e3489f7cd590070772358ef2c84b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124108
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-11-07 18:43:19 +00:00
Johnni Winther d635bdd49c [cfe] Move variance tests to general/
Change-Id: I1d2c48cf96f18a63563a01fe418e3e331061299f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124129
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-11-05 15:02:31 +00:00
Dmitry Stefantsov 2897bebdef [cfe] Resolve serialization mismatch due to variance computation
Change-Id: Id38c63f5bd659f21423d802fd6180aa04465712c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123406
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-10-31 10:15:29 +00:00