Issue 32708. Make GenericFunctionTypeElementForLink implement GenericFunctionTypeElementImpl.

R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/32708
Change-Id: I50e3bf46ca276dbffed9cccb39d800bebb9aec68
Reviewed-on: https://dart-review.googlesource.com/48761
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Konstantin Shcheglov 2018-03-29 19:47:29 +00:00 committed by commit-bot@chromium.org
parent 3306aabd82
commit 98f627f989
4 changed files with 14 additions and 9 deletions

View file

@ -7043,16 +7043,15 @@ set speed2(int ms) {}
}
test_removeTypeAnnotation_avoidTypesOnClosureParameters_FunctionTypedFormalParameter() async {
// Note: explicit type `Function` to work around dartbug.com/32708.
String src = '''
Function functionWithFunction = (/*LINT*/int f(int x)) => f(0);
var functionWithFunction = (/*LINT*/int f(int x)) => f(0);
''';
await findLint(src, LintNames.avoid_types_on_closure_parameters);
await applyFix(DartFixKind.REPLACE_WITH_IDENTIFIER);
verifyResult('''
Function functionWithFunction = (f) => f(0);
var functionWithFunction = (f) => f(0);
''');
}

View file

@ -94,7 +94,7 @@ class AnalysisDriver implements AnalysisDriverGeneric {
/**
* The version of data format, should be incremented on every format change.
*/
static const int DATA_VERSION = 53;
static const int DATA_VERSION = 54;
/**
* The number of exception contexts allowed to write. Once this field is

View file

@ -236,7 +236,7 @@ EntityRefBuilder _createLinkedType(
// TODO(paulberry): do I need to store type arguments?
return result;
}
if (element is GenericFunctionTypeElementForLink) {
if (element is GenericFunctionTypeElementImpl) {
// Function types are their own type parameter context
typeParameterContext = element;
result.entityKind = EntityRefKind.genericFunctionType;
@ -2931,7 +2931,7 @@ class GenericFunctionTypeElementForLink extends Object
TypeParameterizedElementMixin,
ParameterParentElementForLink,
ReferenceableElementForLink
implements GenericFunctionTypeElement, ElementImpl {
implements GenericFunctionTypeElementImpl, ElementImpl {
@override
final CompilationUnitElementForLink enclosingUnit;

View file

@ -9359,13 +9359,19 @@ dynamic x;
}
}
@failingTest
test_type_inference_closure_with_function_typed_parameter() async {
// TODO(paulberry, scheglov): get this test to pass. See dartbug.com/32708.
var library = await checkLibrary('''
var x = (int f(String x)) => 0;
''');
checkElementText(library, '''TODO(paulberry, scheglov)''');
if (isStrongMode) {
checkElementText(library, '''
((String) int) int x;
''');
} else {
checkElementText(library, '''
dynamic x;
''');
}
}
test_type_inference_closure_with_function_typed_parameter_new() async {