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

Side by Side Diff: pkg/kernel/test/class_hierarchy_test.dart

Issue 3004023002: Revert "Fix forEachOverridePair in the case where the class in question is abstract." (Closed)
Patch Set: Created 3 years, 3 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 unified diff | Download patch
« no previous file with comments | « pkg/kernel/lib/src/incremental_class_hierarchy.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:kernel/ast.dart'; 5 import 'package:kernel/ast.dart';
6 import 'package:kernel/class_hierarchy.dart'; 6 import 'package:kernel/class_hierarchy.dart';
7 import 'package:kernel/core_types.dart'; 7 import 'package:kernel/core_types.dart';
8 import 'package:kernel/src/incremental_class_hierarchy.dart'; 8 import 'package:kernel/src/incremental_class_hierarchy.dart';
9 import 'package:kernel/testing/mock_sdk_program.dart'; 9 import 'package:kernel/testing/mock_sdk_program.dart';
10 import 'package:kernel/text/ast_to_text.dart'; 10 import 'package:kernel/text/ast_to_text.dart';
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 procedures: [newEmptyMethod('foo')])); 297 procedures: [newEmptyMethod('foo')]));
298 var b = addClass(new Class( 298 var b = addClass(new Class(
299 name: 'B', 299 name: 'B',
300 supertype: a.asThisSupertype, 300 supertype: a.asThisSupertype,
301 procedures: [newEmptyMethod('foo', isAbstract: true)])); 301 procedures: [newEmptyMethod('foo', isAbstract: true)]));
302 var c = addClass(new Class( 302 var c = addClass(new Class(
303 name: 'C', 303 name: 'C',
304 supertype: a.asThisSupertype, 304 supertype: a.asThisSupertype,
305 procedures: [newEmptyMethod('foo', isAbstract: true)], 305 procedures: [newEmptyMethod('foo', isAbstract: true)],
306 isAbstract: true)); 306 isAbstract: true));
307 var d = addClass(new Class(name: 'D', supertype: b.asThisSupertype));
308 var e = addClass(new Class(name: 'E', supertype: c.asThisSupertype));
307 309
308 _assertTestLibraryText(''' 310 _assertTestLibraryText('''
309 class A { 311 class A {
310 method foo() → void {} 312 method foo() → void {}
311 } 313 }
312 class B extends self::A { 314 class B extends self::A {
313 abstract method foo() → void; 315 abstract method foo() → void;
314 } 316 }
315 abstract class C extends self::A { 317 abstract class C extends self::A {
316 abstract method foo() → void; 318 abstract method foo() → void;
317 } 319 }
320 class D extends self::B {}
321 class E extends self::C {}
318 '''); 322 ''');
319 323
320 _assertOverridePairs(b, [ 324 _assertOverridePairs(b, [
321 'test::A::foo overrides test::B::foo', 325 'test::A::foo overrides test::B::foo',
322 'test::B::foo overrides test::A::foo' 326 'test::B::foo overrides test::A::foo'
323 ]); 327 ]);
324 _assertOverridePairs(c, [ 328 _assertOverridePairs(c, ['test::C::foo overrides test::A::foo']);
325 'test::A::foo overrides test::C::foo', 329 _assertOverridePairs(d, ['test::A::foo overrides test::B::foo']);
326 'test::C::foo overrides test::A::foo' 330 _assertOverridePairs(e, ['test::A::foo overrides test::C::foo']);
327 ]);
328 } 331 }
329 332
330 /// 3. A non-abstract member is inherited from a superclass, and it overrides 333 /// 3. A non-abstract member is inherited from a superclass, and it overrides
331 /// an abstract member declared in this class. 334 /// an abstract member declared in this class.
332 void test_forEachOverridePair_supertypeOverridesThisAbstract() { 335 void test_forEachOverridePair_supertypeOverridesThisAbstract() {
333 var a = addClass(new Class( 336 var a = addClass(new Class(
334 name: 'A', 337 name: 'A',
335 supertype: objectSuper, 338 supertype: objectSuper,
336 procedures: [newEmptyMethod('foo'), newEmptyMethod('bar')])); 339 procedures: [newEmptyMethod('foo'), newEmptyMethod('bar')]));
337 var b = addClass(new Class( 340 var b = addClass(new Class(
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 actualText = actualText.replaceAll(' extends core::Object', ''); 1342 actualText = actualText.replaceAll(' extends core::Object', '');
1340 1343
1341 if (actualText != expectedText) { 1344 if (actualText != expectedText) {
1342 print('-------- Actual --------'); 1345 print('-------- Actual --------');
1343 print(actualText + '------------------------'); 1346 print(actualText + '------------------------');
1344 } 1347 }
1345 1348
1346 expect(actualText, expectedText); 1349 expect(actualText, expectedText);
1347 } 1350 }
1348 } 1351 }
OLDNEW
« no previous file with comments | « 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