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

Unified Diff: pkg/kernel/test/class_hierarchy_test.dart

Issue 2946733003: Fix type inference of getters that "override" setters and vice versa. (Closed)
Patch Set: Address code review comments Created 3 years, 6 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/kernel/test/class_hierarchy_test.dart
diff --git a/pkg/kernel/test/class_hierarchy_test.dart b/pkg/kernel/test/class_hierarchy_test.dart
index 3873b4824a012fb1e2530d04881cacdb626270bc..2c0fbd026b3d5f7cc2fd44542fb4fa273ed76a29 100644
--- a/pkg/kernel/test/class_hierarchy_test.dart
+++ b/pkg/kernel/test/class_hierarchy_test.dart
@@ -995,22 +995,27 @@ class B<T> extends self::A<self::B::T, core::bool> {}
void _assertOverridePairs(Class class_, List<String> expected,
{bool crossGettersSetters: false}) {
List<String> overrideDescriptions = [];
- hierarchy.forEachOverridePair(class_,
- (Member declaredMember, Member interfaceMember, bool isSetter) {
+ void callback(
+ Member declaredMember, Member interfaceMember, bool isSetter) {
String declaredSuffix;
String interfaceSuffix;
+ declaredSuffix = isSetter ? '=' : '';
if (crossGettersSetters) {
- declaredSuffix = _isSetter(declaredMember) ? '=' : '';
- interfaceSuffix = _isSetter(interfaceMember) ? '=' : '';
+ interfaceSuffix = isSetter ? '' : '=';
} else {
- declaredSuffix = isSetter ? '=' : '';
interfaceSuffix = isSetter ? '=' : '';
}
String declaredName = '$declaredMember$declaredSuffix';
String interfaceName = '$interfaceMember$interfaceSuffix';
var desc = '$declaredName overrides $interfaceName';
overrideDescriptions.add(desc);
- }, crossGettersSetters: crossGettersSetters);
+ }
+
+ if (crossGettersSetters) {
+ hierarchy.forEachCrossOverridePair(class_, callback);
+ } else {
+ hierarchy.forEachOverridePair(class_, callback);
+ }
expect(overrideDescriptions, unorderedEquals(expected));
}
@@ -1043,8 +1048,4 @@ import "dart:core" as core;
expect(actualText, expectedText);
}
-
- static bool _isSetter(Member member) {
- return member is Procedure && member.kind == ProcedureKind.Setter;
- }
}
« pkg/kernel/lib/class_hierarchy.dart ('K') | « pkg/kernel/lib/src/incremental_class_hierarchy.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698