mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:51:29 +00:00
[dart2js] Visit type parameter bounds in the scope visitor.
Change-Id: Ief8cc2a88ef0833a10969237fa02cfdec869116d Bug: https://github.com/dart-lang/sdk/issues/42344 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151460 Reviewed-by: Stephen Adams <sra@google.com>
This commit is contained in:
parent
a2cc089472
commit
6c593ac117
|
@ -345,6 +345,9 @@ class ScopeModelBuilder extends ir.Visitor<InitializerComplexity>
|
|||
typeVariable(context.enclosingLibrary), _currentTypeUsage);
|
||||
}
|
||||
}
|
||||
|
||||
visitNode(typeParameter.bound);
|
||||
|
||||
return const InitializerComplexity.constant();
|
||||
}
|
||||
|
||||
|
|
|
@ -217,20 +217,25 @@ class TearOff<T> {
|
|||
method7(T Function() Function() returnsReturnsT) => null; // needs check
|
||||
}
|
||||
|
||||
typedef F1 = dynamic Function(Object?);
|
||||
typedef F2 = dynamic Function(dynamic Function(int));
|
||||
typedef F3 = dynamic Function(dynamic Function(int Function()));
|
||||
typedef F4 = dynamic Function(dynamic Function(int) Function());
|
||||
|
||||
testTearOffRuntimeType() {
|
||||
expectRTTI(tearoff, type) => Expect.equals('${tearoff.runtimeType}', type,
|
||||
expectRTTI(tearoff, type) => Expect.equals(tearoff.runtimeType, type,
|
||||
'covariant params should reify with Object? as their type');
|
||||
|
||||
TearOff<num> t = new TearOff<int>();
|
||||
expectRTTI(t.method1, '(Object?) => dynamic');
|
||||
expectRTTI(t.method1, F1);
|
||||
|
||||
expectRTTI(t.method2, '((int) => dynamic) => dynamic');
|
||||
expectRTTI(t.method3, '(Object?) => dynamic');
|
||||
expectRTTI(t.method2, F2);
|
||||
expectRTTI(t.method3, F1);
|
||||
|
||||
expectRTTI(t.method4, '(Object?) => dynamic');
|
||||
expectRTTI(t.method5, '((() => int) => dynamic) => dynamic');
|
||||
expectRTTI(t.method6, '(() => (int) => dynamic) => dynamic');
|
||||
expectRTTI(t.method7, '(Object?) => dynamic');
|
||||
expectRTTI(t.method4, F1);
|
||||
expectRTTI(t.method5, F3);
|
||||
expectRTTI(t.method6, F4);
|
||||
expectRTTI(t.method7, F1);
|
||||
}
|
||||
|
||||
main() {
|
||||
|
|
|
@ -217,20 +217,25 @@ class TearOff<T> {
|
|||
method7(T Function() Function() returnsReturnsT) => null; // needs check
|
||||
}
|
||||
|
||||
typedef F1 = dynamic Function(Object);
|
||||
typedef F2 = dynamic Function(dynamic Function(int));
|
||||
typedef F3 = dynamic Function(dynamic Function(int Function()));
|
||||
typedef F4 = dynamic Function(dynamic Function(int) Function());
|
||||
|
||||
testTearOffRuntimeType() {
|
||||
expectRTTI(tearoff, type) => Expect.equals('${tearoff.runtimeType}', type,
|
||||
expectRTTI(tearoff, type) => Expect.equals(tearoff.runtimeType, type,
|
||||
'covariant params should reify with Object as their type');
|
||||
|
||||
TearOff<num> t = new TearOff<int>();
|
||||
expectRTTI(t.method1, '(Object) => dynamic');
|
||||
expectRTTI(t.method1, F1);
|
||||
|
||||
expectRTTI(t.method2, '((int) => dynamic) => dynamic');
|
||||
expectRTTI(t.method3, '(Object) => dynamic');
|
||||
expectRTTI(t.method2, F2);
|
||||
expectRTTI(t.method3, F1);
|
||||
|
||||
expectRTTI(t.method4, '(Object) => dynamic');
|
||||
expectRTTI(t.method5, '((() => int) => dynamic) => dynamic');
|
||||
expectRTTI(t.method6, '(() => (int) => dynamic) => dynamic');
|
||||
expectRTTI(t.method7, '(Object) => dynamic');
|
||||
expectRTTI(t.method4, F1);
|
||||
expectRTTI(t.method5, F3);
|
||||
expectRTTI(t.method6, F4);
|
||||
expectRTTI(t.method7, F1);
|
||||
}
|
||||
|
||||
main() {
|
||||
|
|
Loading…
Reference in a new issue