// Copyright (c) 2020, 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'; typedef G = dynamic Function(S); typedef H = dynamic Function>(S, FutureOr); // TODO(johnniwinther): Enable and use these when #41951 is fixed to test that // updating self referencing type parameters works. //typedef I = void Function>(S, T); //typedef J = void Function?>(S, T); //typedef K = void Function>(S, T); class C { G field1; H field2; C(this.field1, this.field2); } test1(C c) { var f1 = c.field1 = (S s) { return s + 1; // ok }; var f2 = c.field2 = >(S s, FutureOr t) async { return (await t) + 1; // ok }; } test2(C c) { var f1 = c.field1 = (S s) { return s + 1; // error }; var f2 = c.field2 = >(S s, FutureOr t) async { return (await t) + 1; // error }; } test3(S s) => s + 1; // error main() {}