Commit Graph

1972 Commits

Author SHA1 Message Date
Dmitry Stefantsov 1b2c267bb2 [cfe] Use unwrapping of nullability constructor in upper bound
Previously to unwrap a type in isTop method the declared nullability
was set to Nullability.nonNullable.  This doesn't work for
intersection type because .withDeclaredNullability() doesn't work for
them.  This CL introduces a method that simulates the removal of the
top-level nullability type constructor from a type term, and uses the
method in isTop to account for intersection types and other possible
similar cases in future.

Change-Id: I3e6f30b5d93850b2cf92475a89d09d6d9255089f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156193
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-29 14:24:05 +00:00
Johnni Winther ac85af3a0c [cfe] Handle type parameters bounded by Null/Never in local function parameter type inference
Closes #42206

Change-Id: Id36fe76d8581ab0712165a8c90f1734d4be1a913
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156186
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-29 14:21:17 +00:00
jlcontreras 35a8b1ec28 Add tests for the Value Class feature.
Add experimental flag to tests.
Add words to test spelling dictionary.

Change-Id: Ie739a84fd85e7f85f312416f34506ee76313803b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156021
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-29 11:47:06 +00:00
Johnni Winther a021b99fc3 [cfe] Fix scope setup for generic function types
Closes #36870
Closes #41951
Closes #42364

Change-Id: Id323bfdc26c688bfeb756ef8c1e0530283b44e34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156028
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-29 09:04:24 +00:00
Johnni Winther 767692b32f [cfe] Remove error/warning on duplicate library name in export/import
Closes #42700

Change-Id: I1fd047ea91de45be727690cf6053298cecf91410
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155326
Reviewed-by: Jens Johansen <jensj@google.com>
2020-07-29 08:53:06 +00:00
Johnni Winther 8e7e400a00 [cfe] Use legacy erasure in LUB computation in opt-out libraries
Closes #42836

Change-Id: Ibe6d8e54e082ffb204ccc18f438809c7776c1cd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156001
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-29 07:36:34 +00:00
Johnni Winther 251c3d7d42 [cfe] Allow nullable arguments to super==
Closes #42603

Change-Id: I52261ccb7c1d88a7469a72e244466b193777fe38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155330
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-28 07:41:01 +00:00
Johnni Winther fffd0d04b1 [cfe] Handle Null/Never-ish spread element types
Closes #42758

Change-Id: I0b25a5a1abc0896300f61fc98f514f1ed1a63e31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155447
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-28 06:29:36 +00:00
Johnni Winther 77fcb33bd0 [cfe] Update local function return type inference
Closes #42721

Change-Id: Ia962c8ff3b6d469a0884b8983994de5c5c2286f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155760
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-28 06:29:17 +00:00
Johnni Winther 4c210e8b98 [cfe] Infer Null from implicit return in function literal type inference
Closes #42743

Change-Id: I7aca374894704cdc002d927aef9ea72cbabd12e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155606
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-28 06:29:17 +00:00
Johnni Winther 45173623e2 [cfe] Add test for issue 42459
Closes #42459

Change-Id: I77215b0b6dcdf4cdbfd07796c41478087607359f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155860
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-28 06:28:34 +00:00
Johnni Winther da663d6eb0 [cfe] Fix bad supertype substitution in mixin check.
Closes #42792

Change-Id: I21757f0f8417ad677d075e8417e390e1fa532a2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155444
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-27 18:43:25 +00:00
Johnni Winther fad5548840 [cfe] Add test for issue for opt-in import of opt-out typedef
Closes #42181

Change-Id: I1557a5843cba6001580d8ff19cd1864e7bc37c48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155400
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-27 18:41:54 +00:00
Johnni Winther 3d4bd859fb [cfe] Add test for type context in cascade
The question of whether type context was correctly passed through
cascade arose during debugging. Added a test to verify that
we handle it correctly.

Change-Id: Ic828296815f7e08af18d9cc8e0708dbc929a20f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155329
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-27 18:41:12 +00:00
Johnni Winther 33378492e5 [cfe] Implement new static types for arithmetic operations
Closes #41559
Closes #42577

Change-Id: I22da02731c106ec354d72a649c5b6ac6091b9292
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155324
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-27 18:40:24 +00:00
Johnni Winther 6a265278f9 [cfe] Fix off-by-one error in type variable target resolution
Change-Id: Ia0adbd27b9f3067d754851f081a25ac4a6126a7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155128
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-27 16:44:40 +00:00
Johnni Winther 2044eae133 [cfe] Add regression test for 40954
Closes #40954

Change-Id: I7cf5cb659291c571d5dd2a5941e4809e6b235145
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155323
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-27 16:03:12 +00:00
Johnni Winther 84d71cdf18 [cfe] Add regression test for 41108
Closes #41108

Change-Id: I6b2f7fb5624901c298e4d4cccb691cfdc52f4e19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155322
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-27 16:02:47 +00:00
Johnni Winther 19ee726cc1 [cfe] Add regression test for issue 42433
Closes #42433

Change-Id: I15360c20616f342d139e46b7bf2bcd52b98333db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155321
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-27 16:02:01 +00:00
Johnni Winther b8dc7627a9 [cfe] Handle NullCheck in constant evaluation
Closes #42802
Closes #42803

Change-Id: I282539cbfef90309dd343950101aefe0820785b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155600
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-23 09:16:09 +00:00
William Hesse 24c7666def Update tests that have the current version number hardcoded
Some package configuration tests have the current version hardcoded
in local package_config.json files. Update these from 2.9 to 2.10.

Change-Id: I77bf63c0e5dfa73aa8a86fb1b4e8a404e8cfaa7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155441
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-22 13:22:07 +00:00
Johnni Winther fcd1c5b61a [cfe] Implement remaining external/abstract field errors
Closes #42718

Change-Id: Ifca0b1e8c1db93cad2283bc1a5d8a0534665e932
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155122
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-21 11:14:52 +00:00
Johnni Winther 84e5eeaea4 [cfe] Ensure legacy result types for invocation and access in opt-out libraries (part 2)
- now also for binary, unary, index-get expressions

Related to #42660

Change-Id: I1bf656a901b64ec916596508167330a235f6c7e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154941
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-21 07:45:44 +00:00
Johnni Winther 87906e832b [cfe] Implemenet abstract fields errors
Change-Id: I78900228ee72d914844e9fe11fcfb2cdef952ece
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154881
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-20 12:05:54 +00:00
Johnni Winther ab10857992 [cfe] Add test for non-const widget constructor
Related to flutter/flutter#60269

Change-Id: I95414b4704485ca6a074fef2559ebe7b4aabe4d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154689
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-17 10:04:15 +00:00
Johnni Winther 92f4eb58c8 [cfe] Support abstract fields
Only positive implementation, no error states are checked yet.

Change-Id: Iad79da1dd7e8be9229ee9d47c5301d39ebc3debc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154003
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-16 10:13:23 +00:00
Johnni Winther ab958bee57 [cfe,flutter] Make widget transformer location parameters optional
The location parameters added to Widgets was created as required
and non-nullable when opting flutter in to null-safety. This leads
to incremental compilation failing because already transformed
constructors require parameters that cannot be passed by user code.

Fixes https://github.com/flutter/flutter/issues/60269

Change-Id: I91cbeaa455e67e82983ebb17f93da13b46376da2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153085
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-16 06:12:13 +00:00
Dmitry Stefantsov ac4de98a29 [cfe] Eliminate UnknownType in async type downcasts
Closes #42615.

Bug: https://github.com/dart-lang/sdk/issues/42615
Change-Id: Ieb289acee04b3868304d320d3c2231fd6eb94dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154322
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-07-14 14:10:19 +00:00
Johnni Winther 49d6781a54 [cfe] Update expectations after sdk change
Closes #42685

Change-Id: Id95c5f07d49811215dea21d10bfea3c92bf0109b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154321
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-14 13:36:50 +00:00
Johnni Winther 76a4ae2931 [cfe] Ensure legacy result types for invocation and access in opt-out libraries
Closes #42660

Change-Id: Ied66fc6c704852d7ab7ad8fde0c78e04be6b9b0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154005
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-14 11:24:44 +00:00
Johnni Winther 7269b792c1 [cfe] Update message for opt-out packages run with sound null safety
This groups the message for opt-out packages and mentions running
'pub outdated' to looked opted in versions.

Closes #42464

Change-Id: Ib3bc411c5f3523af3672bed8837e953aaa551479
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153964
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-13 13:37:55 +00:00
Johnni Winther 27446b463e [cfe] Update test expectation for language/unsorted/flatten_test/12
+ use the inferred return type in error reporting when no return type is
declared. This turned up in this particular case where we report an
error between the returned value and the inferred return type.

Closes #42546

Change-Id: I48da24047f2e92ca91a514dfcb43c2ba6f65ee46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153610
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-10 07:01:18 +00:00
Jens Johansen 3199847b35 [CFE] Don't issue bogus NNBD Strong error as package sets a language version
Before this CL, if one compiled a script as strong nnbd (with nnbd
enabled), where the script was marked as as a version where nnbd is enabled,
but where the script lived in a package with a version that was too low
one would get an error.
The reason is that the language version is set twice:
First when the library is created (but the file isn't read yet). This sets
the version from the package. Here an error was issued.
The second time is when the file is read and the file-version-marker is
parsed (e.g. @dart = 2.9).

The error should only be given if - once the final verison has been set
(i.e. after parsing the file) - the version is "wrong".

To make matters worse the (bogus) error given even points to the files
first position which can make it seem like it specificly points to the
@dart annotation and says it's wrong.

This CL fixes the error so it's only issued when it should be.
It does not fix pointing semi-weirdly.

Fixes https://github.com/dart-lang/sdk/issues/42323

Bug: 42323
Change-Id: Id84ca06b2e4eca5912e65798ed2d86f8c89d71a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153769
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-09 12:42:11 +00:00
Johnni Winther fd432febe0 [cfe] Update messages for invalid returns
Closes #42527

Change-Id: Ic240dd7a8822c85c550941923bf9ce3b5cfe0dba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153348
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-07-08 14:47:14 +00:00
Johnni Winther 9ab7a5edef [cfe] Use variable name in error message for missing initializer
Closes #42610

Change-Id: I70a5ac9302bd6545cd5e73f2dab61a29bc6a3000
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153462
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-08 12:45:15 +00:00
Johnni Winther 233fe72de0 [cfe] Handle extension setters on nullable types
Change-Id: I5b36246038f0c7b94c9d317c2273e00ab8e8772e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152500
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-08 08:47:04 +00:00
Johnni Winther 45af99177b [cfe] Check overrides on operators
Change-Id: Ib250117553b2e22c6c71b78bf354be1162bc9981
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151235
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-08 08:45:34 +00:00
Jens Johansen ad4d43cf5b [CFE] Constant transformation for expression compilation
Fixes https://github.com/dart-lang/sdk/issues/42240

Change-Id: Idc75e99aed6acbb67755c77faa1904183a630f91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153355
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-08 07:17:40 +00:00
Johnni Winther e263b52228 [cfe] Update outline expectations
TBR

Change-Id: I44a90a91f8efd749c031c95788a0e7588feb7bec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153357
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-07 11:45:19 +00:00
Johnni Winther 1ed7581898 [cfe] Add test for issue 42540
Closes #42540

Change-Id: I8ea8f03a2682a5b52867787144a2d81c7527ca11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153340
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-07 08:55:09 +00:00
Jens Johansen 6de0f53e7c [CFE] Set correct async markers in outline phase (2nd try)
This reverts commit b4b44d6b4b.

Change-Id: Iae68e6e84e0fbb214b22e1dec6788057f80a50ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153345
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-07-07 07:49:58 +00:00
Johnni Winther 5d1fbe0497 [cfe] Handle unforseen type parameter intersections
Closes #42089

Change-Id: Ifb0dc0073e004051ae40aed51db24b0d4b10f50d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152646
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-06 10:09:00 +00:00
Jens Johansen 878e2cacdd [CFE] Don't issue an initialization error when trying to initialize when not having a platform
This CL would have reduced the number of errors given in
https://github.com/dart-lang/sdk/issues/42378
Namely the
"Warning: Tried to initialize from a previous compilation (build/cache.dill), but couldn't."
part wouldn't have been issued.

Change-Id: I3e7f2f0115a13a23522643b6f4c9ad8c57bc0d5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153141
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-07-06 07:40:00 +00:00
Johnni Winther 34f5c9d0b4 [cfe] Implement new async return rules
Closes #41800
Closes #41900
Closes #42134
Closes #42282
Closes #42236
Closes #42169

Change-Id: Ia994bc07fba4e2342fcb59d44fc77608198a328b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152150
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-06 07:04:40 +00:00
Johnni Winther 3a4aad6b87 [cfe] Use test description uri for expectation file location
Previously the first file in the `Component.uriToSource` was used which
didn't work nicely with multifile tests.

Text outline expectations were already using the test description uri.

Change-Id: I0d4a7493cd1fa61beffba41f1ea859ca5e8ad08c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151825
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-07-06 07:02:30 +00:00
Johnni Winther 236f3f820d [cfe] Fix flow analysis in initializers
The handling of null shorting in the variable initializer interfered with
the declaration of the variable, making subsequent flow potentially
losing track of promotions.

Closes #42504

Change-Id: Idb17920ffe8746983825714f76160abcca54751b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152760
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-01 08:57:18 +00:00
Johnni Winther 7f1f32904c [cfe] Handle extension on nullable type
.. when the property already exist for the non-nullable type.

Change-Id: Ic083de134ea73592de4d68fb3ecc06ddf8398d65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152331
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-01 07:27:28 +00:00
Johnni Winther cd1b375bbb [cfe] Handle ...?null
Closes #42304

Change-Id: Ia0c8eb101373bd5342e24e4303212997e4b2729f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152656
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-01 06:57:28 +00:00
Johnni Winther d5120208b4 [cfe] Update CFE message to use 'null safety' instead of 'non-nullable'
Closes #42464

Change-Id: I2865cd4ff2fac3c40d5f8b8d26d6b958919682b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152481
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-06-26 13:09:52 +00:00
Jens Johansen b4b44d6b4b Revert "[CFE] Set correct async markers in outline phase"
This reverts commit 2ad66bbffe.

Reason for revert: Seems to break some internal tests.

Original change's description:
> [CFE] Set correct async markers in outline phase
> 
> Change-Id: I4ac1fe1f4195dea2c20b8e55963b7e7dffc2d289
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152330
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Jens Johansen <jensj@google.com>

TBR=jensj@google.com,johnniwinther@google.com

Change-Id: Iaa272f1bee8f99dd93e9a351a03a67f67d83e871
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152641
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-06-26 07:49:57 +00:00