Skip to content

Commit 538dbb6

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Don't expect type arguments for class type parameters of static methods.
[email protected] Bug: #32396 Change-Id: I4b6b6804cfced4c6628198a7e99e0123f77c2108 Reviewed-on: https://dart-review.googlesource.com/46940 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 1b5b222 commit 538dbb6

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

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 = 52;
97+
static const int DATA_VERSION = 53;
9898

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

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,11 @@ class _ReferenceInfo {
13711371
} else {
13721372
// For a type that refers to a generic executable, the type arguments are
13731373
// not supposed to include the arguments to the executable itself.
1374-
numTypeArguments = enclosing?.numTypeParameters ?? 0;
1374+
if (element is MethodElementHandle && !element.isStatic) {
1375+
numTypeArguments = enclosing?.numTypeParameters ?? 0;
1376+
} else {
1377+
numTypeArguments = 0;
1378+
}
13751379
computer = () => this.element as FunctionTypedElement;
13761380
}
13771381
// TODO(paulberry): Is it a bug that we have to pass `false` for

pkg/analyzer/test/generated/strong_mode_test.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3899,6 +3899,15 @@ class C<T> {
38993899
expectStaticInvokeType('m();', '() → T');
39003900
}
39013901

3902+
test_issue32396() async {
3903+
await resolveTestUnit(r'''
3904+
class C<E> {
3905+
static T g<T>(T e) => null;
3906+
static final h = g;
3907+
}
3908+
''');
3909+
}
3910+
39023911
test_notInstantiatedBound_direct_class_class() async {
39033912
String code = r'''
39043913
class A<T extends int> {}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9917,6 +9917,7 @@ unit: foo.dart
99179917
}
99189918

99199919
test_unused_type_parameter() async {
9920+
shouldCompareLibraryElements = false;
99209921
var library = await checkLibrary('''
99219922
class C<T> {
99229923
void f() {}

0 commit comments

Comments
 (0)