Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 98f627f

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Issue 32708. Make GenericFunctionTypeElementForLink implement GenericFunctionTypeElementImpl.
R=brianwilkerson@google.com, paulberry@google.com Bug: dart-lang/sdk#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>
1 parent 3306aab commit 98f627f

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

pkg/analysis_server/test/services/correction/fix_test.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7043,16 +7043,15 @@ set speed2(int ms) {}
70437043
}
70447044

70457045
test_removeTypeAnnotation_avoidTypesOnClosureParameters_FunctionTypedFormalParameter() async {
7046-
// Note: explicit type `Function` to work around dartbug.com/32708.
70477046
String src = '''
7048-
Function functionWithFunction = (/*LINT*/int f(int x)) => f(0);
7047+
var functionWithFunction = (/*LINT*/int f(int x)) => f(0);
70497048
''';
70507049
await findLint(src, LintNames.avoid_types_on_closure_parameters);
70517050

70527051
await applyFix(DartFixKind.REPLACE_WITH_IDENTIFIER);
70537052

70547053
verifyResult('''
7055-
Function functionWithFunction = (f) => f(0);
7054+
var functionWithFunction = (f) => f(0);
70567055
''');
70577056
}
70587057

pkg/analyzer/lib/src/dart/analysis/driver.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class AnalysisDriver implements AnalysisDriverGeneric {
9494
/**
9595
* The version of data format, should be incremented on every format change.
9696
*/
97-
static const int DATA_VERSION = 53;
97+
static const int DATA_VERSION = 54;
9898

9999
/**
100100
* The number of exception contexts allowed to write. Once this field is

pkg/analyzer/lib/src/summary/link.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ EntityRefBuilder _createLinkedType(
236236
// TODO(paulberry): do I need to store type arguments?
237237
return result;
238238
}
239-
if (element is GenericFunctionTypeElementForLink) {
239+
if (element is GenericFunctionTypeElementImpl) {
240240
// Function types are their own type parameter context
241241
typeParameterContext = element;
242242
result.entityKind = EntityRefKind.genericFunctionType;
@@ -2931,7 +2931,7 @@ class GenericFunctionTypeElementForLink extends Object
29312931
TypeParameterizedElementMixin,
29322932
ParameterParentElementForLink,
29332933
ReferenceableElementForLink
2934-
implements GenericFunctionTypeElement, ElementImpl {
2934+
implements GenericFunctionTypeElementImpl, ElementImpl {
29352935
@override
29362936
final CompilationUnitElementForLink enclosingUnit;
29372937

pkg/analyzer/test/src/summary/resynthesize_common.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9359,13 +9359,19 @@ dynamic x;
93599359
}
93609360
}
93619361

9362-
@failingTest
93639362
test_type_inference_closure_with_function_typed_parameter() async {
9364-
// TODO(paulberry, scheglov): get this test to pass. See dartbug.com/32708.
93659363
var library = await checkLibrary('''
93669364
var x = (int f(String x)) => 0;
93679365
''');
9368-
checkElementText(library, '''TODO(paulberry, scheglov)''');
9366+
if (isStrongMode) {
9367+
checkElementText(library, '''
9368+
((String) → int) → int x;
9369+
''');
9370+
} else {
9371+
checkElementText(library, '''
9372+
dynamic x;
9373+
''');
9374+
}
93699375
}
93709376

93719377
test_type_inference_closure_with_function_typed_parameter_new() async {

0 commit comments

Comments
 (0)