Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1374)

Unified Diff: pkg/analyzer/test/src/summary/resynthesize_test.dart

Issue 1686283002: Ensure that element handles never refer to Member objects. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/summary/resynthesize_test.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_test.dart b/pkg/analyzer/test/src/summary/resynthesize_test.dart
index 70f93fbb1e941538584a1e6b6d3d2c5d8d85c70d..9f0d1513e5a5b2069fc29cfff5b308e730c8ecaf 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -788,8 +788,8 @@ class ResynthTest extends ResolverTestCase {
} else if (resynthesized is VoidTypeImpl && original is VoidTypeImpl) {
expect(resynthesized, same(original));
} else if (resynthesized.runtimeType != original.runtimeType) {
- fail(
- 'Type mismatch: expected ${original.runtimeType}, got ${resynthesized.runtimeType}');
+ fail('Type mismatch: expected ${original.runtimeType},'
+ ' got ${resynthesized.runtimeType} ($desc)');
} else {
fail('Unimplemented comparison for ${original.runtimeType}');
}
@@ -815,7 +815,8 @@ class ResynthTest extends ResolverTestCase {
if (constantInitializersAreInvalid) {
_assertUnresolvedIdentifier(initializer, desc);
} else {
- compareConstAsts(initializer, originalActual.constantInitializer, desc);
+ compareConstAsts(initializer, originalActual.constantInitializer,
+ '$desc initializer');
}
}
checkPossibleMember(resynthesized, original, desc);
@@ -890,7 +891,11 @@ class ResynthTest extends ResolverTestCase {
if (element is ElementImpl) {
return element;
} else if (element is ElementHandle) {
- return getActualElement(element.actualElement, desc);
+ Element actualElement = element.actualElement;
+ // A handle should never point to a member, because if it did, then
+ // "is Member" checks on the handle would produce the wrong result.
+ expect(actualElement, isNot(new isInstanceOf<Member>()), reason: desc);
+ return getActualElement(actualElement, desc);
} else if (element is Member) {
return getActualElement(element.baseElement, desc);
} else {

Powered by Google App Engine
This is Rietveld 408576698