Lasse R.H. Nielsen
d352bc28b8
Remove (most) uses of the "non-nullable" experiment flag.
...
Since the flag is now enabled by default, there should be no mention of it.
There are still some uses in front_end/testcases that are not just removable
(it also uses `no-non-nullable`). There migth be more uses that are not
as easily found as grepping for `--enable-experiment
Removes two VM tests where fixing them meant they were just duplicating
the corresponding non *_2/ tests.
Fixes #44941
TEST= Large number of tests chaged.=(no-)?non-nullable`.
Change-Id: Ief755981ccde9a5482fcdf408c2929c74433a710
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183688
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com >
Reviewed-by: Nate Bosch <nbosch@google.com >
2021-02-12 17:16:54 +00:00
Lasse R.H. Nielsen
ef8cc2c1cf
Remove LateInitializationError.
...
As per planned breaking change to let platforms decide how they and what throw for late initiaization errors,
we no longer need a public `LateInitializationError` class. It's confusing to have one if some platforms throw
something else instead.
Removes the public abstract class. The dart:_internal implementation class `LateError` no longer implements it.
This is the only implementation of the public interface, and the class which platforms either throw directly,
or through front-end lowering of the feature.
Remove mentions in tests. All tests now just expect `Error`, some platform specific tests might test the message.
TEST=rewrote tests referring to LateInitializationError.
Change-Id: I54344a67f89ce101ed770412db134e12354cdcc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174928
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com >
Reviewed-by: Nate Bosch <nbosch@google.com >
2021-01-12 20:21:33 +00:00
Alexander Markov
3a75dffd8a
[vm/nnbd] Add check for repeated initialization of late final local variables
...
TEST=tests/language/nnbd/syntax/late_modifier_runtime_error_test.dart
Closes https://github.com/dart-lang/sdk/issues/44372
Change-Id: I93776094914358600b3bd6ae6df649500fcff7b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174980
Reviewed-by: Régis Crelier <regis@google.com >
Commit-Queue: Alexander Markov <alexmarkov@google.com >
2020-12-03 21:48:11 +00:00
Alexander Markov
36015bde54
[vm/nnbd] More detailed error messages for late field/variable errors
...
TEST=tests/language/nnbd/syntax/late_modifier_runtime_error_test.dart
Fixes https://github.com/dart-lang/sdk/issues/44361
Change-Id: I84727583a0b743c5c868921a6148b18f12eb68e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174842
Commit-Queue: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Régis Crelier <regis@google.com >
2020-12-03 02:29:38 +00:00
Johnni Winther
38d7c7661d
[cfe] Special case Null in assignability errors.
...
In error reporting on assignability where the expression has type
`Null` we use a special messages that doesn't state that
"'Null' is nullable". Cases where `Null` is part of the type or where
the expression of type `Null` is derived from a collection are not
special cased.
Closes #43998
Closes #44093
Change-Id: Ic0c79e6362f2365eb3fe8222ccd2ef8fac4f188d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170433
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com >
2020-11-09 11:07:44 +00:00
Johnni Winther
13704520a0
[cfe] Indicate nullability as assignability issue when appropriate
...
Closes #43592 .
Bug: https://github.com/dart-lang/sdk/issues/43592
Change-Id: Ib57a70526a39a7125238546f08e1a2e97c279f0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168860
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2020-10-29 16:10:03 +00:00
Paul Berry
e933e91aaa
Reland "Flow analysis: promote to non-nullable on initialization"
...
This is a reland of 6a1c54ec30
Original change's description:
> Flow analysis: promote to non-nullable on initialization
>
> When flow analysis encounters a variable declaration of the form `T? x
> = expr;`, if the type of `expr` is `T`, then the variable is
> immediately promoted to type `T`.
>
> Fixes #43099 .
>
> Change-Id: Ia206fe0d50e2fdd9bdf637e13c85633d8490dbcc
> Bug: https://github.com/dart-lang/sdk/issues/43099
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163841
> Commit-Queue: Paul Berry <paulberry@google.com >
> Reviewed-by: Bob Nystrom <rnystrom@google.com >
> Reviewed-by: Johnni Winther <johnniwinther@google.com >
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Bug: https://github.com/dart-lang/sdk/issues/43099
Change-Id: I7530bb0f7c24674a7b500558b89d50b35e045aca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166305
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Paul Berry <paulberry@google.com >
2020-10-07 13:14:55 +00:00
Clement Skau
b4f49dc255
Revert "Flow analysis: promote to non-nullable on initialization"
...
This reverts commit 6a1c54ec30 .
Reason for revert: Triggers test failure:
https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-linux-debug-x64/8247
Original change's description:
> Flow analysis: promote to non-nullable on initialization
>
> When flow analysis encounters a variable declaration of the form `T? x
> = expr;`, if the type of `expr` is `T`, then the variable is
> immediately promoted to type `T`.
>
> Fixes #43099 .
>
> Change-Id: Ia206fe0d50e2fdd9bdf637e13c85633d8490dbcc
> Bug: https://github.com/dart-lang/sdk/issues/43099
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163841
> Commit-Queue: Paul Berry <paulberry@google.com >
> Reviewed-by: Bob Nystrom <rnystrom@google.com >
> Reviewed-by: Johnni Winther <johnniwinther@google.com >
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
TBR=paulberry@google.com ,scheglov@google.com ,rnystrom@google.com ,johnniwinther@google.com
Change-Id: I8549b48a734f527194ce11d82235b9d5c6e58185
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/43099
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165564
Reviewed-by: Clement Skau <cskau@google.com >
Commit-Queue: Clement Skau <cskau@google.com >
2020-10-01 08:41:15 +00:00
Paul Berry
6a1c54ec30
Flow analysis: promote to non-nullable on initialization
...
When flow analysis encounters a variable declaration of the form `T? x
= expr;`, if the type of `expr` is `T`, then the variable is
immediately promoted to type `T`.
Fixes #43099 .
Change-Id: Ia206fe0d50e2fdd9bdf637e13c85633d8490dbcc
Bug: https://github.com/dart-lang/sdk/issues/43099
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163841
Commit-Queue: Paul Berry <paulberry@google.com >
Reviewed-by: Bob Nystrom <rnystrom@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
2020-10-01 01:15:31 +00:00
Johnni Winther
4948c31b7a
[test_runner] Support detection of CFE warnings
...
+ some test expectation fixes
Change-Id: Ibf0259914960ea25978f2b8e29aa89336e209f2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162321
Reviewed-by: Bob Nystrom <rnystrom@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2020-09-15 07:57:31 +00:00
Konstantin Shcheglov
8de8a1c226
Move codes from StaticTypeWarningCode into CompileTimeErrorCode.
...
They are all errors now.
Change-Id: If48d38e38e845fd5b5a950dd5514bf1cbbce03d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2020-07-27 16:44:15 +00:00
Konstantin Shcheglov
21cddbd4cf
Fix language/nnbd/syntax/late_modifier_error_test
...
R=brianwilkerson@google.com , paulberry@google.com
Change-Id: Icdefdfcae39a496fff6f8cf0b505b0a67a282ef2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139021
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2020-03-11 15:01:21 +00:00
Konstantin Shcheglov
d7f697f64a
Include additional analyzer errors in language/nnbd/syntax/class_member_declarations_error_test
...
Change-Id: Iee4344a65e85890c3361294a6bdaa0920a3a4f10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2020-03-11 00:45:41 +00:00
Liam Appelbe
2c5a56e7bb
[vm] Disable late field init for constructor initialized fields
...
Change-Id: Ibdab37839d07b77bf2c92a09f760f44b54d94bcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138620
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Commit-Queue: Liam Appelbe <liama@google.com >
2020-03-06 17:10:08 +00:00
Liam Appelbe
331067017f
[vm] Fix late field store bug
...
Late field stores were being incorrectly marked as initializations,
causing them to be incorrectly optimised out in some cases.
Change-Id: I7487d24238af3b3922e76a9ca6ae6df4bf5ab849
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138566
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Liam Appelbe <liama@google.com >
Commit-Queue: Liam Appelbe <liama@google.com >
2020-03-05 23:34:16 +00:00
Liam Appelbe
bd6899269e
[vm] Handle required params in closures and tear-offs
...
I planned to make this conditional on function_.IsClosureFunction, but
the Goto is so trivial that there's no harm in doing this for all
required params (in fact it actually shrinks the prologue size).
Fixes: https://github.com/dart-lang/sdk/issues/39660
Fixes: https://github.com/dart-lang/sdk/issues/38843
Change-Id: I8e4db906ae709778d76c6b81524e45377266e32b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138328
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Commit-Queue: Liam Appelbe <liama@google.com >
2020-03-04 20:57:26 +00:00
Liam Appelbe
149b799ae4
[vm] Check required flag during function resolution.
...
Bug: https://github.com/dart-lang/sdk/issues/39660
Bug: https://github.com/dart-lang/sdk/issues/38843
Change-Id: I2eb5f5ac38d7b1896db5c57399c42cdb41b16094
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137737
Commit-Queue: Liam Appelbe <liama@google.com >
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Régis Crelier <regis@google.com >
2020-03-02 23:05:16 +00:00
Régis Crelier
d10ffdb4c3
[VM/nnbd] Check nullability of function types in strong mode ( fixes #39820 ).
...
Also added "// Requirements=nnbd-strong" to test (correctly fails in weak mode).
Change-Id: If375b912b03c50cf968fcc45bd78be3d9bc1cb33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137241
Commit-Queue: Régis Crelier <regis@google.com >
Reviewed-by: Alexander Markov <alexmarkov@google.com >
2020-02-26 00:05:53 +00:00
Konstantin Shcheglov
550ac009b3
Update tests expectations with DEAD_NULL_AWARE_EXPRESSION.
...
R=brianwilkerson@google.com , paulberry@google.com
Change-Id: I26f585c5ea4ec872d574a8bcd09226b8d1a1cc0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2020-02-25 21:21:16 +00:00
Konstantin Shcheglov
ed705e8c84
Move DEAD_NULL_COALESCE reporting to ErrorVerifier.
...
So, it is reported even when hints are disabled.
Change-Id: Id2df8faa5421fac00e01755a70aedf3d3f570f10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135492
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2020-02-13 19:42:48 +00:00
Liam Appelbe
a793c36c77
[test] Run late field tests in optimised mode
...
Fix the tests by disabling the optimisation that turns getter calls into
raw gets if the field is late, and by calling recording the null init
store in bytecode mode.
Change-Id: I8f12e3237cd32c890b5cef8d00c32940e937330d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134180
Commit-Queue: Liam Appelbe <liama@google.com >
Reviewed-by: Alexander Markov <alexmarkov@google.com >
2020-02-04 16:51:38 +00:00
Liam Appelbe
f5a830a087
[vm] Update late final fields with init to match new spec
...
Spec was updated here: https://github.com/dart-lang/language/pull/720
Bug: https://github.com/dart-lang/sdk/issues/40204
Change-Id: Id4f5bc9a62d9cf5c0b3e4d12a13b3049cbe07a56
Fixed: https://github.com/dart-lang/sdk/issues/40204
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132408
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Commit-Queue: Liam Appelbe <liama@google.com >
2020-01-17 23:51:59 +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
Konstantin Shcheglov
1f511151b5
Restore runtime check for language/nnbd/syntax/late_modifier_final_local_var_test
...
Change-Id: I1acb883285985ca1df0904582033f3569c5f7c13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132026
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2020-01-16 21:16:08 +00:00
Konstantin Shcheglov
a477e051ca
Fix language/nnbd/syntax/late_modifier_final_local_var_test.dart
...
It is a compile time error to assign to a late final local variable
that is definitely assigned.
Change-Id: I1fe0f8567a4a7ede2bb3983495ca24d6f0efe886
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132022
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2020-01-16 18:36:24 +00:00
Leaf Petersen
12310ebcc0
Convert late field syntax test to static error test
...
Change-Id: I725cec70cb2a93d2fb2c92b5cb8d7efb156bae94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131040
Reviewed-by: Erik Ernst <eernst@google.com >
2020-01-14 19:06:06 +00:00
Leaf Petersen
e50d98cd56
Fix some incorrect NNBD tests.
...
Closes https://github.com/dart-lang/sdk/issues/39814
Closes https://github.com/dart-lang/sdk/issues/39823
Closes https://github.com/dart-lang/sdk/issues/39816
Change-Id: I5015d5cb43b27a555360423cc9567c5880c948e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128777
Reviewed-by: Erik Ernst <eernst@google.com >
2019-12-19 18:43:03 +00:00
Paul Berry
608e6bfa6a
Move pre_nnbd_modifiers_test.dart into language_2.
...
This test is intended to test that:
- Prior to the release of NNBD (i.e. with the experiment flag off),
`late` and `required` continue to be usable as identifiers.
- After the release of NNBD (i.e. with the experiment flag on), `late`
and `required` are usable as identifiers in opted-out code.
Hence it doesn't belong in tests/language/nnbd. Moving it back into
language_2 with the other legacy tests.
Change-Id: Ica3c60deb43721ef73ec4527c6b83d39ee369282
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128760
Commit-Queue: Paul Berry <paulberry@google.com >
Reviewed-by: Bob Nystrom <rnystrom@google.com >
2019-12-17 20:09:04 +00:00
Robert Nystrom
3455133d98
Move NNBD tests (language_2/nnbd) to new NNBD test directory.
...
Change-Id: I0765a1e0fb19f38d7ad1c8655ba444f2f46fbf6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128301
Reviewed-by: Paul Berry <paulberry@google.com >
Reviewed-by: Siva Annamalai <asiva@google.com >
Commit-Queue: Bob Nystrom <rnystrom@google.com >
2019-12-12 22:52:31 +00:00