7e8348f4ce
The current implementation of this check is incorrect and produces false negatives. Conservatively assuming that one type is always a potential subtype of another is a simple fix to get this working. The main downsides are that we may emit signatures and provide type arguments to functions even when they're not needed because we no longer statically deduce that a type check must fail. This may cause size regressions. I've added a TODO to add proper constraint solving per the local type inference spec, but this is not currently a priority since no regression is observed on large Google apps. Change-Id: Ie5065596331c33a030e06e66481f258ef937e659 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155544 Reviewed-by: Stephen Adams <sra@google.com> Commit-Queue: Mayank Patke <fishythefish@google.com>
22 lines
521 B
Dart
22 lines
521 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.
|
|
|
|
// @dart = 2.7
|
|
|
|
/*spec.class: A:direct,explicit=[A.T*],needsArgs*/
|
|
/*prod.class: A:needsArgs*/
|
|
class A<T> {
|
|
@pragma('dart2js:noInline')
|
|
m() {
|
|
return /*needsSignature*/(T t, String s) {};
|
|
}
|
|
}
|
|
|
|
@pragma('dart2js:noInline')
|
|
test(o) => o is void Function(int);
|
|
|
|
main() {
|
|
test(new A<int>().m());
|
|
}
|