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

Unified Diff: tests/language_strong/generic_methods_overriding_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
Index: tests/language_strong/generic_methods_overriding_test.dart
diff --git a/tests/language_strong/generic_methods_overriding_test.dart b/tests/language_strong/generic_methods_overriding_test.dart
deleted file mode 100644
index 2ef1def02b8ed3a576e83a9b29729e81f3537953..0000000000000000000000000000000000000000
--- a/tests/language_strong/generic_methods_overriding_test.dart
+++ /dev/null
@@ -1,62 +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.
-
-// Test that generic methods can be overloaded (a) with widened type bounds, and
-// (b) using the bound as the type of the parameter in the overloaded method.
-
-library generic_methods_overriding_test;
-
-import "package:expect/expect.dart";
-
-class X {}
-
-class Y extends X {}
-
-class Z extends Y {}
-
-class C {
- String fun<T extends Y>(T t) => "C";
-}
-
-class D extends C {
- String fun<T extends X>(T t) => "D"; //# 01: compile-time error
- String fun<T extends Y>(T t) => "D"; //# 02: ok
-}
-
-class E extends C {
- String fun<T>(Y y) => "E"; //# 03: compile-time error
- String fun<T extends Y>(Y y) => "E"; //# 04: ok
-}
-
-class F extends C {
- String foobar(Z z) {
- return "FZ";
- }
-
- String fun<T extends Y>(T t) {
- if (t is Z) {
- return this.foobar(t as Z); //# 05: ok
- return this.foobar(t); //# 06: ok
- }
- return "FY";
- }
-}
-
-main() {
- Y y = new Y();
- Z z = new Z();
-
- C c = new C();
- D d = new D();
- E e = new E();
- F f = new F();
-
- Expect.equals(c.fun<Y>(y), "C");
- Expect.equals(d.fun<Y>(y), "D"); //# 02: continued
- Expect.equals(e.fun<Y>(y), "E"); //# 04: continued
- Expect.equals(f.fun<Y>(y), "FY"); //# 05: continued
- Expect.equals(f.fun<Z>(z), "FZ"); //# 05: continued
- Expect.equals(f.fun<Y>(y), "FY"); //# 06: continued
- Expect.equals(f.fun<Z>(z), "FZ"); //# 06: continued
-}

Powered by Google App Engine
This is Rietveld 408576698