Skip to content

Commit

Permalink
[element model] fix unsafe member to ExecutableFragment cast
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pq authored and Commit Queue committed Nov 4, 2024
1 parent b0e3448 commit 6523606
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1286,8 +1286,8 @@ class Interface {
/// The map of names to their signature in the interface.
@experimental
Map<Name, ExecutableElement2> get map2 {
return map.map((name, element) =>
MapEntry(name, (element as ExecutableFragment).element));
return map
.map((name, element) => MapEntry(name, element.asExecutableElement2));
}

/// Return `true` if the [name] is implemented in the supertype.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ class C {
''');
}

test_class_withGenericSuper() async {
// https://github.com/dart-lang/sdk/issues/57022
await assertNoDiagnostics(r'''
class A<T> {
void m() {}
}
class C extends A<Object> { }
''');
}

test_class_withInstanceField() async {
await assertNoDiagnostics(r'''
class C {
Expand Down

0 comments on commit 6523606

Please sign in to comment.