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

Side by Side Diff: frog/tests/leg/src/ResolverTest.dart

Issue 9359016: Implement is-Operator for interfaces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/leg/emitter.dart ('k') | tests/co19/co19-leg.status » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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("../../../leg/leg.dart"); 5 #import("../../../leg/leg.dart");
6 #import("../../../leg/elements/elements.dart"); 6 #import("../../../leg/elements/elements.dart");
7 #import("../../../leg/tree/tree.dart"); 7 #import("../../../leg/tree/tree.dart");
8 #import("../../../leg/util/util.dart"); 8 #import("../../../leg/util/util.dart");
9 #import("mock_compiler.dart"); 9 #import("mock_compiler.dart");
10 #import("parser_helper.dart"); 10 #import("parser_helper.dart");
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 class B extends A {} 473 class B extends A {}
474 main() { return new A(); }"""); 474 main() { return new A(); }""");
475 FunctionElement mainElement = compiler.mainApp.find(MAIN); 475 FunctionElement mainElement = compiler.mainApp.find(MAIN);
476 compiler.resolver.resolve(mainElement); 476 compiler.resolver.resolve(mainElement);
477 Expect.equals(0, compiler.warnings.length); 477 Expect.equals(0, compiler.warnings.length);
478 Expect.equals(1, compiler.errors.length); 478 Expect.equals(1, compiler.errors.length);
479 Expect.equals(MessageKind.CYCLIC_CLASS_HIERARCHY, 479 Expect.equals(MessageKind.CYCLIC_CLASS_HIERARCHY,
480 compiler.errors[0].message.kind); 480 compiler.errors[0].message.kind);
481 481
482 compiler = new MockCompiler(); 482 compiler = new MockCompiler();
483 compiler.parseScript("""interface A extends B {}
484 interface B extends A {}
485 class C implements A {}
486 main() { return new C(); }""");
487 mainElement = compiler.mainApp.find(MAIN);
488 compiler.resolver.resolve(mainElement);
489 Expect.equals(0, compiler.warnings.length);
490 Expect.equals(1, compiler.errors.length);
491 Expect.equals(MessageKind.CYCLIC_CLASS_HIERARCHY,
492 compiler.errors[0].message.kind);
493
494 compiler = new MockCompiler();
483 compiler.parseScript("""class A extends B {} 495 compiler.parseScript("""class A extends B {}
484 class B extends C {} 496 class B extends C {}
485 class C {} 497 class C {}
486 main() { return new A(); }"""); 498 main() { return new A(); }""");
487 mainElement = compiler.mainApp.find(MAIN); 499 mainElement = compiler.mainApp.find(MAIN);
488 compiler.resolver.resolve(mainElement); 500 compiler.resolver.resolve(mainElement);
489 Expect.equals(0, compiler.warnings.length); 501 Expect.equals(0, compiler.warnings.length);
490 Expect.equals(0, compiler.errors.length); 502 Expect.equals(0, compiler.errors.length);
491 ClassElement aElement = compiler.mainApp.find(buildSourceString("A")); 503 ClassElement aElement = compiler.mainApp.find(buildSourceString("A"));
492 Link<Type> supertypes = aElement.allSupertypes; 504 Link<Type> supertypes = aElement.allSupertypes;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; 600 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1;
589 601
590 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); 602 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1);
591 603
592 List<String> asSortedStrings(Link link) { 604 List<String> asSortedStrings(Link link) {
593 List<String> result = <String>[]; 605 List<String> result = <String>[];
594 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); 606 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString());
595 result.sort((s1, s2) => s1.compareTo(s2)); 607 result.sort((s1, s2) => s1.compareTo(s2));
596 return result; 608 return result;
597 } 609 }
OLDNEW
« no previous file with comments | « frog/leg/emitter.dart ('k') | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698