Commit Graph

1972 Commits

Author SHA1 Message Date
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
Jens Johansen 071210f735 [CFE] Fix expression compilation with extensions
Change-Id: I139b0b7f433fbafbde9cdd0506590fbd98543a3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133587
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-01-29 13:33:41 +00:00
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
Jens Johansen d21c4e4fa5 [CFE] [Incremental compiler] Convert all SourceLibraryBuilders to DillLibraryBuilders
This CL adds another "phase" in the incremental compiler: Convert all
SourceLibraryBuilders to DillLibraryBuilders.
This is done to remedy/fix http://dartbug.com/39840 where the FFI
transformation causes us to crash because theres a differense between
the internal world (SourceLibraryBuilder content) and the external world
(the transformed Library). By converting the SourceLibraryBuilder to a
DillLibraryBuilder the internal world (the builder) is now up-to-date
with any changes done in a transformation step.

This CL does not (at least currently) add a callback mechanism for
transformations so they can say if they changed the structure of the
output. This might still be neccessary as we reuse the (kernel) class
hierarchy and that thus is not (with this change) correctly updated.

Change-Id: Ie659d41c47c2b781753a1606db561e0802fd713f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133065
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-28 09:43:17 +00:00
Dmitry Stefantsov d370cabc5e [cfe] Report errors on supertypes marked with "?"
Closes #40087.

Bug: http://dartbug.com/40087
Change-Id: I3b44472f3a778e44a648b0ffd4a5c704b6f4d0c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133220
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-01-24 12:50:09 +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 b2de23d88d [CFE] Messages test doesn't allow status updates for spelling tests
Change-Id: Ic200af202691568dffe5b7578cd9524d8e52c0e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133103
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-01-24 10:15:26 +00:00
Dmitry Stefantsov c05e2f1177 [cfe] Report errors on missing default values of optional parameters
The CL also fixes a bug: the required modifier in parameters of local
functions and function expressions wasn't handled.

Closes #40085.

Bug: http://dartbug.com/40085
Change-Id: Ic75fca5870f567ddf2e19aa3a96f83e9117540ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132280
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-23 15:51:37 +00:00
Jens Johansen e84bea25df [CFE] Fix crash in incremental compiler caused by async redirecting factory
Redirectig factories are encoded in a special way to "recover" their data
(together with _redirecting# field). Before this CL, if a redirecting
factory was async (that's an error) it was encoded so we couldn't load
that dill again and that we would throw an error if we tried.
This CL fixes that.

Change-Id: If73ef5f662fb23bc083eb1af086d9d7694ca538c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133061
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-01-23 12:52:57 +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
Dmitry Stefantsov 619fcd9ad1 [cfe] Allow invocations of Object's member on nullable receivers
Closes #40079.

Bug: http://dartbug.com/40079
Change-Id: Ib837a96c8ceb3371dfce61fdda2229800afa1336
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132605
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-21 13:12:11 +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 45e966a9eb [cfe] Ensure internal fields for late lowering are not overridden.
Change-Id: I3b40c311cd81966d3c09ee362b96cc7d98890d66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131829
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-17 08:01:45 +00:00
Dmitry Stefantsov 8f382d1385 [cfe] Report errors on method calls with potentially nullable receiver
Closes #40080.

Bug: http://dartbug.com/40080
Change-Id: I21ece74cb57d0ca55f7d62133fc4d17d6bc1e457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131838
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-01-16 14:52:11 +00:00
Dmitry Stefantsov 369bfd094a [cfe] Fix type inference for various if-null nodes
Change-Id: I70abfb7032194cac07028b50d16125e74b518bb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131823
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-16 09:39:49 +00:00
Jens Johansen 128771af8a [CFE] Version 2 of incremental compiler invalidation strategy
Change-Id: Iff860e2665dee64fc005a50237ae890986ddb0f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127896
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-16 07:50:39 +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 862d5012ae [cfe] Handle explicit opt-out in nnbd-not-enabled message
Closes #39835

Change-Id: I4ffa3377289f45b7ea909b5477ba53508040b9d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131076
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-01-15 10:30:43 +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 280fbf2c15 [cfe] Handle type variable typed late fields and locals
Change-Id: I98fb0526369881506b1a494f9b30de4a25dbbc57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131068
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-01-14 14:27:35 +00:00
Johnni Winther c7da96dade [cfe] Report error on await in late local initializer
Closes #40090

Change-Id: I2b3864fa2b77da021b6cc73b79ac91121ee4fec1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131621
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-14 14:04:25 +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
Ben Konyi 83fba7bd54 [ VM ] Move vmservice_io code from runtime/bin to dart:_internal/vm/bin
Change-Id: I3966366268ac88c0bc3b639fc76ae543cde5653c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131502
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-01-14 01:42:14 +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 c656a0596e [cfe] Synthesize null initializer for required named parameters
The initializer is required for weak mode and won't affect the strong
mode.

Change-Id: I719fad1ee73e4e7b01c6608f931c37d038db01b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130700
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-01-10 09:02:27 +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 1eacac48cf [cfe] Make .{thisF,f}unctionType nullability-aware
Change-Id: I4a83f4db7d6412165882e4a1f08c7fded6b9ea3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130373
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-01-08 11:52:06 +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
Jens Johansen ecae983ef3 [CFE] Fix incremental compiler and incremental serialization when package changes path
The incremental compiler doesn't initialize from dill when it finds that
something in that dill has changed path (because of a change in package
version for instance).

Before this CL, though, it still initialized the incremental serializer
from the data, leading to weird and wrong results: If a package still in
use had been changed it could output the old serialization for that
package because invalidations didn't come into effect (as the incremental
compiler was starting from scratch and there thus was no libraries that
it didn't reuse (which are the ones that are "invalidated" in the
serialization world)).

This CL fixes the issue by only initializing the incremental serializer
when the incremental compiler has sucessfully initialized from the dill.

This should fix the problem that caused #39851.

Fixes #39851.

Change-Id: Ia62c4b7d96878174e0950a0dbbcdcbc4187615c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130371
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-07 13:10:33 +00:00
Johnni Winther 679705faf6 [cfe] Include nullability in implicit tearoff
Change-Id: If350915c13840c06d9fb2191972edf52758de252
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129287
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-03 15:19:29 +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
Johnni Winther 52090670eb [cfe] Add tests for late extension fields
Change-Id: I2cd4fd1903ec97c513a803d687f2269bbde7c5ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129061
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-12-19 11:34:30 +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 578e22fd10 [cfe] Fix bug with assigning an object with .call to a Function
Change-Id: I3066a2453737b1e88a778d660b57b93986164a2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128734
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-12-18 13:19:11 +00:00
Jens Johansen 464b254d58 [CFE] Test for FFI and incremental compilation
This currently crashes the compiler.

Bug: #39840
Change-Id: I59d625158c8011846a3181eba8b4da2ce4b49cd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128731
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-12-18 10:26:51 +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 77d066fd7d [cfe] Report errors on nnbd features used in opt-out libraries
Change-Id: I8131464fff9f09a90083581f10933430133cfaed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128406
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-12-16 09:02:17 +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