Rollback checking bounds of type parameters of function type aliases.

The line:

List<DartType> parameterTypes = element.type.typeArguments;

returns an empty list for typedefs.

For now I want to unblock Keerti.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2027723002 .
This commit is contained in:
Konstantin Shcheglov 2016-05-31 10:51:23 -07:00
parent f54e667773
commit 3d70bc399e
4 changed files with 15 additions and 4 deletions

View file

@ -5199,7 +5199,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
return;
}
Element element = type.element;
if (element is TypeParameterizedElement) {
if (element is ClassElement) {
// prepare type parameters
List<TypeParameterElement> parameterElements = element.typeParameters;
List<DartType> parameterTypes = element.type.typeArguments;

View file

@ -5125,6 +5125,19 @@ F<B> fb;
verify([source]);
}
void test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_hasBound2() {
Source source = addSource(r'''
class MyClass<T> {}
typedef MyFunction<T, P extends MyClass<T>>();
class A<T, P extends MyClass<T>> {
MyFunction<T, P> f;
}
''');
computeLibrarySourceErrors(source);
assertNoErrors(source);
verify([source]);
}
void test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_noBound() {
Source source = addSource(r'''
typedef F<T>();

View file

@ -1381,7 +1381,7 @@ f() { return new G<A>(); }
[StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
}
void test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias() {
void fail_typeArgumentNotMatchingBounds_ofFunctionTypeAlias() {
assertErrorsInCode(
r'''
class A {}

View file

@ -21,8 +21,6 @@ Language/Types/Interface_Types/subtype_t12: fail, OK
Language/Expressions/Constants/exception_t01: fail, OK
Language/Expressions/Constants/exception_t02: fail, OK
Language/Generics/syntax_t04: StaticWarning # co19 issue #56
LibTest/isolate/IsolateStream/any_A01_t01: Fail # co19-roll r706: Please triage this failure.
LibTest/isolate/IsolateStream/asBroadcastStream_A01_t01: Fail # co19-roll r706: Please triage this failure.
LibTest/isolate/IsolateStream/contains_A01_t01: Fail # co19-roll r706: Please triage this failure.