Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: tests/language_strong/generic_typedef_test.dart

Issue 3001803002: Migrate block 114 (and some of 113). (Closed)
Patch Set: Tweak app_jit status. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language_strong/generic_test.dart ('k') | tests/language_strong/generics2_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language_strong/generic_typedef_test.dart
diff --git a/tests/language_strong/generic_typedef_test.dart b/tests/language_strong/generic_typedef_test.dart
deleted file mode 100644
index e6ad21e2bae55567ca935115bc789d892389cc2f..0000000000000000000000000000000000000000
--- a/tests/language_strong/generic_typedef_test.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:expect/expect.dart';
-
-
-// Test runtime behavior of generic function typedefs:
-//
-// - use "is" and "as" on them.
-// - get Type values from runtimeType.
-// - pass type parameters from another generic type to them.
-
-typedef A<T> = T Function(T x, T y);
-typedef B = T Function<T>(T x, T y);
-
-typedef C<K> = Map<K, V> Function<V>(K k, V v);
-typedef D = Map<String, V> Function<V>(String k, V v);
-
-class G<Y, Z> {
- test() {
- dynamic d = (Y x, Y y) => y;
- Expect.isTrue(d is A<Y>);
- Expect.equals(d is A<Z>, Y == Z);
-
- Expect.isFalse(d is B);
- Expect.throws(() => d as B);
-
- d = (Y y, Z z) => <Y, Z>{};
- Expect.isFalse(d is C<Y>);
-
- d = <S>(Y y, S s) => <Y, S>{};
- Expect.isTrue(d is C<Y>);
- Expect.equals(d is C<Z>, Y == Z);
- Expect.equals(d is D, Y == String);
- }
-}
-
-main() {
- dynamic d = (int x, int y) => x + y;
- Expect.isTrue(d is A<int>);
- Expect.equals((d as A<int>)(1, 2), 3);
-
- Expect.isFalse(d is B);
- Expect.throws(() => d as B);
-
- d = <S>(S x, S y) => x is String ? x : y;
- Expect.isFalse(d is A);
- Expect.throws(() => d as A);
-
- Expect.isTrue(d is B);
- // TODO(jmesserly): Analyzer incorrectly rejects this form:
- // Expect.equals((d as B)<int>(1, 2), 2);
- B b = d;
- Expect.equals(b<int>(1, 2), 2);
- Expect.equals(b<String>('a', 'b'), 'a');
-
-
- new G<int, String>().test();
- new G<String, String>().test();
-}
« no previous file with comments | « tests/language_strong/generic_test.dart ('k') | tests/language_strong/generics2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698