From 4154446c4fdd2ab31fa8329d26493f21bd2e79d6 Mon Sep 17 00:00:00 2001 From: Bob Nystrom Date: Wed, 13 Dec 2017 13:44:03 -0800 Subject: [PATCH] Fix a couple of strong mode runtime cast errors. In strong mode, a generic type instantiated with dynamic is not a subtype of all types. You can't pass a List to something expecting, say, List. These errors are usually detected statically, and most of those have been fixed. However, sometimes this becomes a runtime cast, as in: main() { // Store a List in a variable of type dynamic. dynamic d = []; // Implicit runtime downcast from dynamic to List. List s = d; } In order to ease the migration to strong mode, DDC has been ignoring these cast failures when they involve certain commonly used types. We are now in the process of actively fixing those errors. More context: https://github.com/dart-lang/sdk/issues/27223 --- CHANGELOG.md | 12 ++++++++---- lib/src/runner/remote_listener.dart | 6 +++--- pubspec.yaml | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e292dc058..ec39b3d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.12.30 + +* Fix strong mode runtime cast failures. + ## 0.12.29 * Node.js tests can now import modules from a top-level `node_modules` @@ -88,13 +92,13 @@ ## 0.12.23+1 -* Remove unused imports. +* Remove unused imports. ## 0.12.23 * Add a `fold_stack_frames` field for `dart_test.yaml`. This will allow users to customize which packages' frames are folded. - + ## 0.12.22+2 * Properly allocate ports when debugging Chrome and Dartium in an IPv6-only @@ -111,11 +115,11 @@ ## 0.12.22 * Add a `retry` option to `test()` and `group()` functions, as well - as `@Retry()` annotation for test files and a `retry` + as `@Retry()` annotation for test files and a `retry` configuration field for `dart_test.yaml`. A test with reties enabled will be re-run if it fails for a reason other than a `TestFailure`. - + * Add a `--no-retry` runner flag that disables retries of failing tests. * Fix a "concurrent modification during iteration" error when calling diff --git a/lib/src/runner/remote_listener.dart b/lib/src/runner/remote_listener.dart index bf08c44f6..29f7ebcfa 100644 --- a/lib/src/runner/remote_listener.dart +++ b/lib/src/runner/remote_listener.dart @@ -80,7 +80,7 @@ class RemoteListener { verboseChain = metadata.verboseTrace; var declarer = new Declarer( metadata: metadata, - platformVariables: message['platformVariables'].toSet(), + platformVariables: new Set.from(message['platformVariables']), collectTraces: message['collectTraces'], noRetry: message['noRetry']); @@ -116,8 +116,8 @@ class RemoteListener { return controller.foreign; } - /// Returns a [Set] from a JSON serialized list. - static Set _deserializeSet(List list) { + /// Returns a [Set] from a JSON serialized list of strings. + static Set _deserializeSet(List list) { if (list == null) return null; if (list.isEmpty) return null; return new Set.from(list); diff --git a/pubspec.yaml b/pubspec.yaml index cbbb80e91..10ed71bdc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: test -version: 0.12.29 +version: 0.12.30-dev author: Dart Team description: A library for writing dart unit tests. homepage: https://github.com/dart-lang/test