Commit Graph

35 Commits

Author SHA1 Message Date
Robert Nystrom a4b09ac192 Migrate language_2/control_flow_collections to NNBD.
Change-Id: I8b9b7d70abc47d672c68db65bc67d08beb7d41a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142089
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-04-04 00:04:27 +00:00
Aske Simon Christensen 88c0c11612 Remove constant-update-2018 flag from tests.
Change-Id: I85d3d0180bb7f5973ad2da946a3519c553fc7f92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113991
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-08-22 11:00:54 +00:00
Nicholas Shahan 25bac04503 [tests] Delete temporary const tests
These tests acted as a guard to make sure we didn't unintentionally enable control flow and spread
in const collections when we initially shipped the features. Now that we are getting close to
enabling them for const they no longer valid.

Added a few more compile-time errors to the const spread error suite.

Change-Id: I52e215d4c1c4394f1a1b868c05241277b0d58d2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108680
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-07-11 16:29:28 +00:00
Kevin Millikin 64b0ce5b58 Remove UI as code experimental flags from our tests
The features control-flow-collections and spread-collections have been
shipped and it is no longer necessary for tests to explicitly opt into
them.

Change-Id: I074b91d12e4e485ee4a64147947bb1113899ecdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104780
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2019-06-06 13:17:49 +00:00
Aske Simon Christensen f051cd5b4d [CFE] Transform spread and if in const collections early.
This makes sure that the AST before constant evaluation only contains
official kernel nodes.

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

Change-Id: Ic4e8e15adeaea8ad4700d6feb67e31f5f0a54f7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103123
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-05-21 11:07:26 +00:00
Nicholas Shahan 9df061524f [tests] Update expected error NoSuchMethodError --> Error
Most (all?) implementations now throw ArgumentError since the
StreamIterator constructor no longer accepts null but the actual
type is not specified.
https://dart-review.googlesource.com/c/sdk/+/98001.

Change-Id: I10a24a67aa7353552c56d435ef206a2bc4f842fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100987
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2019-05-02 19:26:55 +00:00
Nicholas Shahan 9d15138c91 [tests] Revert the previous deletion of UI-as-Code const tests
Returning since they should be valid with the `constant-update-2018` experiment
flag:
* control_flow_collections/if_const_test.dart
* control_flow_collections/if_const_error_test.dart
* spread_collections/const_test.dart
* spread_collections/const_error_test.dart

Should be deleted when UI-as-Code is supported in constant collections:
* control_flow_collections/if_const_syntax_error_test.dart
* spread_collections/const_syntax_error_test.dart

Change-Id: I595333782630122ae4f3d021841b062b27e1cccb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99600
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-04-16 23:04:37 +00:00
Sigmund Cherem 8e73b3c006 Enable ui-as-code features.
Change-Id: I97781ffe5144c4b959cb3cb720e9cd06c22928ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99283
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-04-16 21:29:55 +00:00
Nicholas Shahan 6dc209e858 [tests] UI-as-Code in const collections is a compile time error
* Update tests to expect compilation errors when `if` `for` or `...` are used in
  const collections.
* Remove constant-update-2018 flag from tests.

Change-Id: I477c30f07c7e3da6139f263e1855c3908c1bce2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99485
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-04-16 20:02:29 +00:00
Mayank Patke 11a3dd7332 Split up language_2/control_flow_collections/for_test.
This helps triage/resolve various issues in testRuntimeErrors:
* for_non_bool_condition_test isolates the code causing a crash on the
dart2js-production-linux-d8 configuration. (See
https://github.com/dart-lang/sdk/issues/36442 and the status file.)
* for_null_condition_test will be an approved failure for all dart2js
configurations due to https://github.com/dart-lang/sdk/issues/36446.
* for_runtime_error_test contains all the remaining expected type
errors. On the dart2js-production-linux-d8 configuration (which runs
with -O3), we assume no type errors exist - even ones guarded by
Expect.throwsTypeError - so the optimized code produces runtime errors
instead. See https://dart-review.googlesource.com/c/sdk/+/97820 for a
similar discussion.
* for_test contains the remaining tests, which are valid on all dart2js
configurations.

Change-Id: Ifef4f7d2e27e2731cdd4a3fec03754ea63b6328d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98606
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2019-04-03 19:40:32 +00:00
Mayank Patke 82f8477314 Split up language_2/control_flow_collections/if_test.
This helps triage/resolve issues in testRuntimeErrors:
* if_null_condition_test will be an approved failure for all dart2js
configurations due to https://github.com/dart-lang/sdk/issues/34147.
* if_runtime_error_test contains all the expected type errors. On the
dart2js-production-linux-d8 configuration (which runs with -O3), we
assume no type errors exist - even ones guarded by
Expect.throwsTypeError - so the optimized code produces runtime errors
instead. See https://dart-review.googlesource.com/c/sdk/+/97820 for a
similar discussion.

Change-Id: Iaf2df85af16cc03fcd7ec7ef2a9e57a2bc3ce081
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98622
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2019-04-03 19:33:26 +00:00
Bob Nystrom ab065aedda Fix a potential infinite loop in type_error_test.
Change-Id: Id5806187d82aeaf07462df1bfd5ae095f1542611
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98454
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-04-03 17:13:31 +00:00
Mayank Patke 50d4e489d4 Fix type comparisons in language_2/control_flow_collections.
Types are compared with `Expect.equals` instead of `Expect.identical`
since they are not always canonicalized.

Change-Id: I43c878986d190c361efaae321621f204a4bb8495
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98425
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2019-04-02 17:24:49 +00:00
Erik Ernst 69790e7eb4 Updated Dart.g, tests & status files to support ui-as-code collections
Change-Id: I9ba3aa4e3ebaedee3a2cd20ccdcc533af96b9bda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98018
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2019-03-29 13:33:52 +00:00
Bob Nystrom 0eb76a5b5a Move await for of null tests to a different file.
Those will be failing in 2.3, and we don't want that to make the entire
await_for_test to fail.

Change-Id: I5f81ada877a5ecef8a3034f071313a6729b53aaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98242
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2019-03-28 23:45:29 +00:00
Nicholas Shahan add5a27120 [infra] Add constant-update-2018 flag to v2.3 lang features tests
Patched changes from https://dart-review.googlesource.com/c/sdk/+/97939

Removed the change to the language_2_kernel.status

Kernel team can update as needed.

Change-Id: Icc347081e6c00fb2ae7616afb452e2c652f9d6b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97942
Reviewed-by: Vijay Menon <vsm@google.com>
2019-03-28 01:35:53 +00:00
Bob Nystrom ffee99d79b Add asyncExpectThrows<T>() to async_helper.
This lets you test that a callback returns a Future that completes to
a given error. Like Expect.throws(), but async.

At first, I added support for this directly to Expect.throws(), but I
think it's better to minimize the amount of dynamic logic going on in
the language test framework.

I was worried about having to duplicate all of the Expect.throws___()
convenience functions but now that we have generic methods, those
functions aren't that much more convenient.

Change-Id: I8b288945611fa16f8d27056f3cf79181fc22d256
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97881
Reviewed-by: William Hesse <whesse@google.com>
2019-03-27 18:26:15 +00:00
Bob Nystrom 9ea9612ce8 Object can be used in for-in and await for elements.
It's not a compile error. Instead, a runtime cast is inserted.

Change-Id: I871191d9f6fdb72276449abe7016c86ac098fd60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97946
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-03-27 17:46:10 +00:00
Bob Nystrom 73d5c6bab0 Make the collection await for test actually return a stream.
Change-Id: Ie4991915be68500f5edcb7e2cf9a50b84c8ba7e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97880
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2019-03-26 16:42:25 +00:00
Bob Nystrom f09097bab8 Add tests for "await for" in collection literals.
This doesn't cover all of the corner cases around the synthesized
stream subscription and stuff, but I honestly don't know if I'm
qualified to write those tests. This should cover all of the basic
static and runtime semantics that users care about.

Change-Id: I7237f0ccb9bf02af291d3175ab2c0074d0547c92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97548
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2019-03-25 21:48:25 +00:00
Bob Nystrom 74b7890597 Fix a few mistakes and oversights in the control flow collection tests.
- Use "{" and "}" for maps.
- Add tests for Object and non-Iterable in for-in loop.
- Fix copy/paste error in inference test.

Change-Id: I563df4e94e221a1a03bbc52cf6f312aae5e07310
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97524
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2019-03-21 23:22:51 +00:00
Bob Nystrom 9910374c20 Fix mistakes in control flow ambiguity test.
Change-Id: I3e710b68c24e2896c55661fac0a59463b9240c53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97283
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-03-19 17:28:00 +00:00
Bob Nystrom efb3f85c7e Fix for element type inference tests.
Change-Id: I17a924126e0f9294f1ad212ebd12c81abca05d16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97170
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2019-03-19 00:57:11 +00:00
Kevin Millikin 495b9c4519 Remove set-literals experimental flag from tests
The set-literals feature has shipped and is on be default.  There is
no longer any need to pass it as an option to tests and the tools
cannot remove support for the flag while it is used in tests.

Change-Id: Ibf105ec01193ebb08d6e22600e6c7748897cc2ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96941
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2019-03-15 07:41:11 +00:00
Nicholas Shahan 5b07ef9d1c [tests] Fix new tests
* Add missing const on expected set.
* Add missing type to map literal.

Change-Id: I25fdfe45926b4943f17661ad5f392ea53ad1f06b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96850
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-03-14 00:44:46 +00:00
Mark Zhou 3cf7d6a9c7 [tests] Changing expected cast errors to type errors for collections tests
Change-Id: I0e48dba7b1612994075629c43331794bfb2d2530
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96421
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2019-03-11 21:56:41 +00:00
Nicholas Shahan d2d098405f [tests] Fix some control flow collections tests
- Remove tests that expect ForElements in const collections.
- Add missing value (or was it the key) in map.

Change-Id: Ic61cbb4326a105618ae4ea169655411359c52045
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96020
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-03-08 17:27:38 +00:00
Brian Wilkerson a47ffd2b50 Fix some errors in the control flow collections tests
Change-Id: I87ba6b3d2860439c33b62c02e8f9294d65d31abc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95900
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2019-03-07 21:54:55 +00:00
Bob Nystrom 57f16820cd Add tests for "await" inside spread, if, and for.
These don't try to comprehensively cover every interaction of async
and the new syntax, but they should test that an implementation handles
an await appearing in all the various places in the new syntax where an
expression is permitted.

Change-Id: I4852815002fcad6697f3bad4103693b1d4288d06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94121
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-03-06 00:10:04 +00:00
Brian Wilkerson 48ee388791 Fix a typo in a shared test
Change-Id: I096e459ffeae70f944d03715081c3b9f653b01a6
Reviewed-on: https://dart-review.googlesource.com/c/94843
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2019-02-28 21:25:49 +00:00
Nicholas Shahan 646c1f679a [tests] Minor fixes in control flow collections for tests
Change-Id: I61bbe247b8474a6eeb2d63f9acbd99218f2d04e6
Reviewed-on: https://dart-review.googlesource.com/c/94140
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-02-23 01:37:41 +00:00
Bob Nystrom 6cf71022a8 Add a test for type promotion in "if" collection elements.
Change-Id: Ibdb5002fc7646b80978ea447fedd97606476630d
Reviewed-on: https://dart-review.googlesource.com/c/93301
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-02-20 02:03:01 +00:00
Nicholas Shahan 80798fad97 [tests] Add missing parenthesis on <list|map|set>Equals() calls
Change-Id: I2d4fc114ad01ba075c644285d7e87b89570f626b
Reviewed-on: https://dart-review.googlesource.com/c/92661
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-02-13 23:51:37 +00:00
Nicholas Shahan d93ef933d5 [tests] Add 'spread-collections' flag
Some of the new control flow collections tests are using the spread operator.

Change-Id: Id050025342692a5e3d88471840c4f0ca5cdab5da
Reviewed-on: https://dart-review.googlesource.com/c/92480
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-02-11 19:52:19 +00:00
Bob Nystrom c4dcd85b3a Tests for control flow collections.
Change-Id: I41050143611bdb816b5d91a6cd6f668536b613df
Reviewed-on: https://dart-review.googlesource.com/c/91600
Reviewed-by: Leaf Petersen <leafp@google.com>
2019-02-02 00:34:01 +00:00