Files
sdk/tests/language_2/generic_methods_generic_function_result_test.dart
T
Régis Crelier 708952b3b0 Do not conflate 2 issues into 1 test.
Passing the type argument vector <int> in the 'none' configuration is not
correct, but this is not what this test is supposed to check.

Change-Id: I2afd2987e572a6b4340a7d70ee92878abc67055e
Reviewed-on: https://dart-review.googlesource.com/8729
Reviewed-by: Ben Konyi <bkonyi@google.com>
2017-09-26 23:19:15 +00:00

29 lines
890 B
Dart

// 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.
//
// VMOptions=--generic-method-syntax,--error-on-bad-type
// Verify that function type parameter S can be resolved in bar's result type.
// Verify that generic function types are not allowed as type arguments.
import "package:expect/expect.dart";
int foo
<T> //# 01: continued
(int i, int j) => i + j;
List<int Function
<T> //# 01: compile-time error
(S, int)> bar<S extends int>() {
return <int Function
<T> //# 01: continued
(S, int)>[foo, foo];
}
void main() {
var list = bar<int>();
print(list[0].runtimeType);
Expect.equals(123, list[1](100, 23));
}