Commit Graph

4770 Commits

Author SHA1 Message Date
Vijay Menon 5a5f4010d5 [js] cleanup old dart:js / js_util files
These files have been moved to standard locations in earlier CLs to prep for NNBD migration.
We'll need to cleanup Flutter and internal references to these files before landing this CL.

Change-Id: I965c2395f3ccf88e5628e5f4e24d28be81b15b39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131841
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2020-01-21 14:06:32 +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
Jens Johansen 566cd23ec8 [CFE] Cleanup no longer used 'normalize' for types
Change-Id: Ib0fd8bcce0d7c6face60a55272b29aa28a40ac93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131830
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-01-16 12:50:43 +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
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 99e2a348b3 [dart2js,cfe] Move filenames.dart to _fe_analyzer_shared
... and use it fix perf_test on Windows

`currentDirectory` is replaced by `Uri.base` (the former sounded more magical than it was!)

Change-Id: I5fb8dc5dba004ebad221d4b39d213d51964c5ea2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131622
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-01-15 10:12:23 +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 22951565c5 [cfe] ClassHierarchyBuilder cleanup before adding member signatures
Change-Id: I2e9f677973bae3f9609a196308f170093a09c267
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131069
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-14 14:54:29 +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
Johnni Winther d08f070b28 [cfe] Add canonical way to detect the synthesized redirecting factory field
Change-Id: Ied5ffe786558856c4e63881880cbd19fa0bd6c68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131620
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-14 09:42:45 +00:00
Vijay Menon 28c335d5a2 Move dart:js to patch format
This is prep for nnbd port to ensure APIs remain consistent across DDC and Dart2JS.

Change-Id: I8ec6c5b152eb87868038570f2275e82af3325fb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131000
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-01-12 01:13:53 +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
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
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
Johnni Winther 008e6ae60b [analyzer,cfe,dart2js] Add skipMap to id-testing
This supports skipping tests per configuration, for instance to add
nnbd-only tests and skip these in non-nnbd configurations.

Change-Id: I7eaebaa16d67129ce60cffa3594c766ff5e5bc66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130376
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-01-08 14:47:28 +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
Johnni Winther 64dae246db [dart2js] Use CFE constant evaluator for non-required constants
Change-Id: Id363332caf29e98307553ec048c2dea36c739d95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129701
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-01-08 08:21:59 +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
Dmitry Stefantsov d8a211206a [cfe] Fix upper bound algorithm for optional positional parameters
Closes #39930.

Bug: http://dartbug.com/39930
Change-Id: If102ccfbd7fe439c29e803cf9bb16f2dfa317892
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130366
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-07 09:16:12 +00:00
Johnni Winther 96a8282cd9 [cfe] Use structural equality for generic function types
Change-Id: Iecff57779243e042c5e9cad96c96139da9d93380
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129719
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-01-07 07:52:32 +00:00
Jens Johansen 871cd09121 Make flutter-frontend test pass again
Ignore a test that us web-only which the current setup doesn't
support.
Also fix a issue with how we answer configurable import questions ---
something that for now is untested (except that it makes a test work here).

Change-Id: Ic19858838c45f1d4ce718aae0f526b2f16f3e9d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130365
Commit-Queue: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-06 14:46:19 +00:00
Dmitry Stefantsov 89e95a550c [cfe] Choose parameter's bound of LHS in lower / upper bounds algorithms
Change-Id: I2757e1a64928f0e8247c75a703b0ab28d7c59667
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130363
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-01-06 14:27:59 +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 fdf362e9bb [cfe] Replace isImplicitCall with ExpressionInvocation node
Change-Id: I05ebe260b9f35cacf59390963da9d0c39ede2096
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129286
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-01-03 15:19:29 +00:00
Johnni Winther e3a20bf361 [analyzer,cfe,dart2js] Support annotated code generation
Add support for generating annotations from actual data using
option -g

Change-Id: I88d9cdb62a38d579234b15097c9e9bb3d81ebe8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129708
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-03 13:57:39 +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
Sigmund Cherem 884f7af3ce Whitelist _2 suites as opted out from NNBD
Change-Id: I66cc12858b3166b7c635fc91693dddc7ba362fca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128779
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-12-18 18:11:31 +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
Johnni Winther a5f028ee06 [cfe] Add ForInVariable to encapsulate handling of for-in without variable declaration
Change-Id: I5e6ce4bfca26e8afd7fbf4dd60a3ffc3afafdf26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128586
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-12-18 10:02: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
Johnni Winther 904a822432 [cfe+analyzer] Use TryStatement for try/catch and try/finally in CFE
This includes an alignment of assigned variables info collection between
analyzer and cfe by always collecting assigned variables info for both
the try statement and the try block.

Change-Id: I789527adc24da025a85e73cdd98392efe7fc97bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128407
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-12-16 13:55:50 +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 eda5188a0e [cfe] Implement flow analysis on if elements
Change-Id: I5d8afac580c0bd038e3287bea6dd74cb51f3f2f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128541
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-12-16 11:48:07 +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
Sigmund Cherem 35bc105c45 Whitelist all packages in the .packages file as opt-out from nnbd.
Change-Id: Ic52130d4853a32664ab0fe9db32be12e55d763db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128421
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2019-12-13 21:19:54 +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