File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ class TypeHierarchyComputer {
159159
160160class TypeHierarchyComputerHelper {
161161 final Element pivotElement;
162- final LibraryElement pivotLibrary;
162+ final LibraryElement ? pivotLibrary;
163163 final ElementKind pivotKind;
164164 final String ? pivotName;
165165 final bool pivotFieldFinal;
@@ -192,7 +192,7 @@ class TypeHierarchyComputerHelper {
192192
193193 return TypeHierarchyComputerHelper (
194194 pivotElement,
195- pivotElement.library! ,
195+ pivotElement.library,
196196 pivotElement.kind,
197197 pivotElement.name,
198198 pivotFieldFinal,
@@ -211,6 +211,12 @@ class TypeHierarchyComputerHelper {
211211 if (pivotName == null ) {
212212 return null ;
213213 }
214+
215+ var pivotLibrary = this .pivotLibrary;
216+ if (pivotLibrary == null ) {
217+ return null ;
218+ }
219+
214220 ExecutableElement ? result;
215221 // try to find in the class itself
216222 if (pivotKind == ElementKind .METHOD ) {
Original file line number Diff line number Diff line change @@ -237,6 +237,10 @@ abstract class MyInterface {
237237 await _testMarkedContent (content, otherContent: mixinsContent);
238238 }
239239
240+ Future <void > test_never_issue61420 () => _testMarkedContent ('''
241+ Ne^ver value = throw '';
242+ ''' , expectResults: false );
243+
240244 Future <void > test_nonDartFile () async {
241245 newFile (pubspecFilePath, simplePubspecContent);
242246 await initialize ();
Original file line number Diff line number Diff line change @@ -1657,6 +1657,14 @@ extension type E(A it) implements A {
16571657 expect (itemE.memberElement, isNull);
16581658 }
16591659
1660+ Future <void > test_never_issue61420 () async {
1661+ addTestFile ('''
1662+ Never value = throw 'error';
1663+ ''' );
1664+ var items = await _getTypeHierarchyOrNull ('Never' );
1665+ expect (items, isNull);
1666+ }
1667+
16601668 void _assertMember (TypeHierarchyItem item, String search) {
16611669 expect (item.memberElement! .location! .offset, findOffset (search));
16621670 }
@@ -1683,6 +1691,7 @@ extension type E(A it) implements A {
16831691 await waitForTasksFinished ();
16841692 var request = _createGetTypeHierarchyRequest (search, superOnly: superOnly);
16851693 var response = await serverChannel.simulateRequestFromClient (request);
1694+ expect (response.error, isNull);
16861695 return SearchGetTypeHierarchyResult .fromResponse (
16871696 response,
16881697 clientUriConverter: server.uriConverter,
You can’t perform that action at this time.
0 commit comments