e22706793d
There were a pair of TODOs in constraint gathering in type inference, where objects with .call methods should be considered as if they were subtypes of function types. Fix them. This is a partial fix for https://github.com/dart-lang/sdk/issues/33298 because it does not yet handle the case of generic .call methods. Bug: https://github.com/dart-lang/sdk/issues/33298 Change-Id: Ib9803db9a152cdc6f2108e717bb0934c38016a94 Reviewed-on: https://dart-review.googlesource.com/58206 Commit-Queue: Kevin Millikin <kmillikin@google.com> Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
32 lines
759 B
Dart
32 lines
759 B
Dart
// Copyright (c) 2018, 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.
|
|
|
|
class A {
|
|
String call(String s) => '$s$s';
|
|
}
|
|
|
|
class B<T> {
|
|
T call(T t) => t;
|
|
}
|
|
|
|
class C {
|
|
T call<T>(T t) => t;
|
|
}
|
|
|
|
test() {
|
|
A a = A();
|
|
List<String> list1 = ['a', 'b', 'c'].map(a.call).toList();
|
|
List<String> list2 = ['a', 'b', 'c'].map(a).toList();
|
|
|
|
B<String> b = B();
|
|
List<String> list3 = ['a', 'b', 'c'].map(b.call).toList();
|
|
List<String> list4 = ['a', 'b', 'c'].map(b).toList();
|
|
|
|
C c = C();
|
|
List<String> list5 = ['a', 'b', 'c'].map(c.call).toList();
|
|
List<String> list6 = ['a', 'b', 'c'].map(c).toList();
|
|
}
|
|
|
|
main() {}
|