From 3d70bc399e08a6c3bfedbaaf7a87683746bccb72 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Tue, 31 May 2016 10:51:23 -0700 Subject: [PATCH] Rollback checking bounds of type parameters of function type aliases. The line: List 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 . --- pkg/analyzer/lib/src/generated/error_verifier.dart | 2 +- .../test/generated/non_error_resolver_test.dart | 13 +++++++++++++ .../generated/static_type_warning_code_test.dart | 2 +- tests/co19/co19-analyzer2.status | 2 -- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart index 78b7cf3b8c0..4c09be9c11e 100644 --- a/pkg/analyzer/lib/src/generated/error_verifier.dart +++ b/pkg/analyzer/lib/src/generated/error_verifier.dart @@ -5199,7 +5199,7 @@ class ErrorVerifier extends RecursiveAstVisitor { return; } Element element = type.element; - if (element is TypeParameterizedElement) { + if (element is ClassElement) { // prepare type parameters List parameterElements = element.typeParameters; List parameterTypes = element.type.typeArguments; diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart index 41a51856980..1be8c5ba9df 100644 --- a/pkg/analyzer/test/generated/non_error_resolver_test.dart +++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart @@ -5125,6 +5125,19 @@ F fb; verify([source]); } + void test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_hasBound2() { + Source source = addSource(r''' +class MyClass {} +typedef MyFunction>(); +class A> { + MyFunction f; +} +'''); + computeLibrarySourceErrors(source); + assertNoErrors(source); + verify([source]); + } + void test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_noBound() { Source source = addSource(r''' typedef F(); diff --git a/pkg/analyzer/test/generated/static_type_warning_code_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_test.dart index 381313efeae..241e3af4ba1 100644 --- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart +++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart @@ -1381,7 +1381,7 @@ f() { return new G(); } [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); } - void test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias() { + void fail_typeArgumentNotMatchingBounds_ofFunctionTypeAlias() { assertErrorsInCode( r''' class A {} diff --git a/tests/co19/co19-analyzer2.status b/tests/co19/co19-analyzer2.status index 8ee787d55ed..fd026980cc2 100644 --- a/tests/co19/co19-analyzer2.status +++ b/tests/co19/co19-analyzer2.status @@ -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.