Index: pkg/analysis_server/test/services/search/search_engine_test.dart |
diff --git a/pkg/analysis_server/test/services/search/search_engine_test.dart b/pkg/analysis_server/test/services/search/search_engine_test.dart |
index 86f1d6f0241f6aac737c2931c0228ce1758aa448..8072301d51afba0ca33948440d62f83583c7758b 100644 |
--- a/pkg/analysis_server/test/services/search/search_engine_test.dart |
+++ b/pkg/analysis_server/test/services/search/search_engine_test.dart |
@@ -617,6 +617,23 @@ main(A<int> a) { |
await _verifyReferences(method, expected); |
} |
+ test_searchReferences_null_noUnitElement() async { |
+ _indexTestUnit(''' |
+class A { |
+ m() {} |
+} |
+main(A a) { |
+ a.m(); |
+} |
+'''); |
+ MethodElement method = findElement('m'); |
+ List<SearchMatch> matches = await searchEngine.searchReferences(method); |
+ expect(matches, hasLength(1)); |
+ // Set the source contents, so the element is invalidated. |
+ context.setContents(testSource, ''); |
+ expect(matches.single.element, isNull); |
+ } |
+ |
test_searchReferences_ParameterElement_ofConstructor() async { |
_indexTestUnit(''' |
class C { |