Commit Graph

22 Commits

Author SHA1 Message Date
Robert Nystrom 0e5417a48f Rename mis-named NNBD language tests.
Without "_test" in the name, the test runner ignores them.

Change-Id: I7dc2da51b980b1b5512fc2c2087238129bf1bd78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200930
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2021-05-28 01:12:07 +00:00
Ben Konyi d7ccc3ca6a Revert "Fix orphaned files in tests/language/ and tests/language_2/."
This reverts commit 1989b7f376.

Reason for revert: Bots are sad, red, and purple

Original change's description:
> Fix orphaned files in tests/language/ and tests/language_2/.
>
> Some of these should be tests but were missing "_test". Others seemed
> to simply be dead code. Some should have been referenced but there were
> mistakes in the imports in other files.
>
> Change-Id: If6f1d9e52a4babbf9883ddd437fc3091179f2ef2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198141
> Auto-Submit: Bob Nystrom <rnystrom@google.com>
> Commit-Queue: Bob Nystrom <rnystrom@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>

TBR=lrn@google.com,leafp@google.com,rnystrom@google.com

Change-Id: I8d63af684023e99849addf9d1c3f87d6bcfbe89d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200531
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-05-18 21:28:01 +00:00
Robert Nystrom 1989b7f376 Fix orphaned files in tests/language/ and tests/language_2/.
Some of these should be tests but were missing "_test". Others seemed
to simply be dead code. Some should have been referenced but there were
mistakes in the imports in other files.

Change-Id: If6f1d9e52a4babbf9883ddd437fc3091179f2ef2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198141
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-05-18 00:36:52 +00:00
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
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
Erik Ernst ecc87a177f Correct tests with unintended syntax errors
Change-Id: Id33f3088391815686b04f437cbf756b5718ed9bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163664
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-09-22 06:59:43 +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 ba92b78acd Move errors from StaticWarningCode to CompileTimeErrorCode.
Bug: https://github.com/dart-lang/sdk/issues/42821
Change-Id: I153c48d7a2e4a02026928e6203aacf8f2dc029ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155849
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-26 04:19:25 +00:00
Paul Berry 6547f741b6 Add language tests illustrating issue #42603.
Bug: https://github.com/dart-lang/sdk/issues/42603
Change-Id: I1d59b7b65d77e5f1accb4f9c3c99e92e48ffb364
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153709
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-07-13 18:12:39 +00:00
Leaf Petersen db36f1190f [Language] Various NNBD Tests.
Add a variety of small nnbd tests covering the specification
changes/clarifications landed in
https://github.com/dart-lang/language/pull/1003 .

Change-Id: I0716f14652128323bf103df154efb5bf978091d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150160
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-06-05 23:53:20 +00:00
Robert Nystrom 114eea60bb Skip mixed-mode tests under language/nnbd in strong mode.
These tests all are or import legacy libraries, so are no longer
supported in NNBD strong mode. Adding Requirements=nnbd-weak tells the
test runner to skip that test when running in strong mode.

I deleted mixed_bottom_type_strong_test.dart entirely since it seems to
be specific to strong mode but is a legacy library. It is no longer
meaningful and there is already a corresponding weak test.

Change-Id: I5a8ec93114ad29abc3d12e356eeb7bf9efd3e1c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148234
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2020-05-21 17:34:43 +00:00
Liam Appelbe 87b829bacd [nnbd] Fix some more strong mode tests
All these tests now pass in both weak and strong mode, except for
relation_subclass_test and typedef_reflected_type_test. For those 2
tests I fixed the compile time error and now they have the same runtime
errors in both weak and strong mode (they were already failing at
runtime in weak mode).

Change-Id: If0157f811fffcf72a12ce6690ac0568c8f4419a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144343
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-04-22 00:12:24 +00:00
Konstantin Shcheglov 23a8788f6a Issue 41378. Update on-catch and throw for the spec changes.
Now it is not an error to use a potentially nullable type in on-catch.

But it is an error for throw an expression of type that is not
assignable to Object.

Bug: https://github.com/dart-lang/sdk/issues/41378
Change-Id: If0a198ae618cd01d03f45a46aa1efa6179df76ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143220
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-11 20:08:03 +00:00
Leaf Petersen b135aab6d7 Fix bad test expectation, convert to static error test
Change-Id: I821dd3af8c1be346d983bd41bb80efefba176cd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143102
Auto-Submit: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2020-04-10 18:07:44 +00:00
Konstantin Shcheglov 4a5e6e649a Update default_list_constructor_test to reflect that any use of the default List constructor is an error.
Change-Id: I97657eb8c44fd07c4940b757d6962534b8276e36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140766
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-03-24 20:01:55 +00:00
Liam Appelbe ba9e4116ab [testing] Fix unchecked_use_of_nullable_test
typeParametersNullableBounds and typeParametersNullableUses are never
invoked, so can't generate runtime errors.

Bug: https://github.com/dart-lang/sdk/issues/39755
Change-Id: If1b17264c0376d0046851553e3ab282926c97da2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129201
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-12-20 16:40:20 +00:00
Konstantin Shcheglov d321f6e452 Issue 39773. Don't report MISSING_DEFAULT_VALUE_FOR_PARAMETER when no default value is allowed.
This partially reverts https://dart-review.googlesource.com/c/sdk/+/126801

Bug: https://github.com/dart-lang/sdk/issues/39773
Change-Id: Ib147ed770d9bf328dd7792a37a72291070411964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129142
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-19 23:35:13 +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
Konstantin Shcheglov 6c99171686 Report CompileTimeErrorCode.EXPORT_LEGACY_SYMBOL
Change-Id: Icd43121a4d7f20fdecc1bff8ced6b9378ce94149
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128377
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-14 01:14:55 +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