Skip to content

Commit 6523606

Browse files
pqCommit Queue
authored andcommitted
[element model] fix unsafe member to ExecutableFragment cast
Fixes: #57022 Bug: #57022 Change-Id: Icb00f89089565679109b749d1a43d95f4c8b09b6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393401 Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent b0e3448 commit 6523606

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,8 +1286,8 @@ class Interface {
12861286
/// The map of names to their signature in the interface.
12871287
@experimental
12881288
Map<Name, ExecutableElement2> get map2 {
1289-
return map.map((name, element) =>
1290-
MapEntry(name, (element as ExecutableFragment).element));
1289+
return map
1290+
.map((name, element) => MapEntry(name, element.asExecutableElement2));
12911291
}
12921292

12931293
/// Return `true` if the [name] is implemented in the supertype.

pkg/linter/test/rules/avoid_classes_with_only_static_members_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ class C {
147147
''');
148148
}
149149

150+
test_class_withGenericSuper() async {
151+
// https://github.com/dart-lang/sdk/issues/57022
152+
await assertNoDiagnostics(r'''
153+
class A<T> {
154+
void m() {}
155+
}
156+
class C extends A<Object> { }
157+
''');
158+
}
159+
150160
test_class_withInstanceField() async {
151161
await assertNoDiagnostics(r'''
152162
class C {

0 commit comments

Comments
 (0)