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

Side by Side Diff: tests/language/flatten_test.dart

Issue 1023903002: Implement the new definition of flatten() from r44569 in analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'dart:async';
6
7 class Derived<T> implements Future<T> {
8 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
9 }
10
11 class FixedPoint<T> implements Future<FixedPoint<T>> {
12 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
13 }
14
15 class Divergent<T> implements Future<Divergent<Divergent<T>>> {
16 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
17 }
18
19
20 test() async {
21 // flatten(Derived<int>) = int
22 int x = await new Derived<int>(); /// 01: runtime error
23 Future<int> f() async => new Derived<int>(); /// 02: ok
24 Future<int> f() async { return new Derived<int>(); } /// 03: ok
25 Future<int> x = (() async => new Derived<int>())(); /// 04: runtime error
26
27 // flatten(FixedPoint<int>) = FixedPoint<int>
28 FixedPoint<int> x = await new FixedPoint<int>(); /// 05: runtime error
29 Future<FixedPoint<int>> f() async => new FixedPoint<int>(); /// 06: ok
30 Future<FixedPoint<int>> f() async { return new FixedPoint<int>(); } /// 07: ok
31 Future<FixedPoint<int>> x = (() async => new FixedPoint<int>())(); /// 08: run time error
32
33 // flatten(Divergent<int>) = Divergent<Divergent<int>>
34 Divergent<Divergent<int>> x = await new Divergent<int>(); /// 09: runtime erro r
35 Future<Divergent<Divergent<int>>> f() async => new Divergent<int>(); /// 10: o k
36 Future<Divergent<Divergent<int>>> f() async { return new Divergent<int>(); } / // 11: ok
37 Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())(); // / 12: runtime error
38 }
39
40 main() {
41 test();
42 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698