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

Side by Side Diff: tests/lib/async/future_or_bad_type_test.dart

Issue 2647833002: fix #28008, fix #28009 implement FutureOr<T> (Closed)
Patch Set: Merge remote-tracking branch 'origin/master' into 28008_futureort Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « sdk/lib/async/future_impl.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // In non strong-mode, `FutureOr<T>` is dynamic, even if `T` doesn't exist. 5 // In non strong-mode, `FutureOr<T>` is dynamic, even if `T` doesn't exist.
6 // `FutureOr<T>` can not be used as superclass, mixin, nor can it be 6 // `FutureOr<T>` can not be used as superclass, mixin, nor can it be
7 // implemented (as interface). 7 // implemented (as interface).
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
11 11
12 class A 12 class A
13 extends FutureOr<String> /// extends: compile-time error 13 extends FutureOr<String> /// extends: compile-time error
14 extends Object with FutureOr<bool> /// with: compile-time error 14 extends Object with FutureOr<bool> /// with: compile-time error
15 implements FutureOr<int> /// implements: compile-time error 15 implements FutureOr<int> /// implements: compile-time error
16 { 16 {
17 } 17 }
18 18
19 main() { 19 main() {
20 // FutureOr<T> should be treated like `dynamic`. Dynamically the `T` is 20 // FutureOr<T> should be treated like `dynamic`. Dynamically the `T` is
21 // completely ignored. It can be a malformed type. 21 // completely ignored. It can be a malformed type.
22 Expect.isTrue(499 is FutureOr<A>); /// 00: static type warning 22 Expect.isTrue(499 is FutureOr<A>);
23 Expect.isTrue(499 is FutureOr<Does<Not<Exist>>>); /// 01: static type warning 23 Expect.isTrue(499 is FutureOr<Does<Not<Exist>>>); /// 00: static type warning
24 Expect.isTrue(499 is FutureOr<A, A>); /// 01: static type warning
24 25
25 var a = new A(); 26 var a = new A();
26 Expect.isTrue(a.toString() is String); 27 Expect.isTrue(a.toString() is String);
27 } 28 }
OLDNEW
« no previous file with comments | « sdk/lib/async/future_impl.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698