// Copyright (c) 2015, 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 'dart:async'; class Derived implements Future { noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); } class FixedPoint implements Future> { noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); } class Divergent implements Future>> { noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); } test() async { // flatten(Derived) = int int x = await new Derived(); //# 01: runtime error Future f() async => new Derived(); //# 02: ok Future f() async { return new Derived(); } //# 03: ok Future x = (() async => new Derived())(); //# 04: runtime error // flatten(FixedPoint) = FixedPoint FixedPoint x = await new FixedPoint(); //# 05: runtime error Future> f() async => new FixedPoint(); //# 06: ok Future> f() async { return new FixedPoint(); } //# 07: ok Future> x = (() async => new FixedPoint())(); //# 08: runtime error // flatten(Divergent) = Divergent> Divergent> x = await new Divergent(); //# 09: runtime error Future>> f() async => new Divergent(); //# 10: ok Future>> f() async { return new Divergent(); } //# 11: ok Future>> x = (() async => new Divergent())(); //# 12: runtime error } main() { test(); }