| OLD | NEW |
| 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 | 7 |
| 8 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution
.dart"; | 8 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution
.dart"; |
| 9 import "compiler_helper.dart"; | 9 import "compiler_helper.dart"; |
| 10 import "parser_helper.dart"; | 10 import "parser_helper.dart"; |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 | 629 |
| 630 testClassHierarchy() { | 630 testClassHierarchy() { |
| 631 final MAIN = buildSourceString("main"); | 631 final MAIN = buildSourceString("main"); |
| 632 MockCompiler compiler = new MockCompiler(); | 632 MockCompiler compiler = new MockCompiler(); |
| 633 compiler.parseScript("""class A extends B {} | 633 compiler.parseScript("""class A extends B {} |
| 634 class B extends A {} | 634 class B extends A {} |
| 635 main() { return new A(); }"""); | 635 main() { return new A(); }"""); |
| 636 FunctionElement mainElement = compiler.mainApp.find(MAIN); | 636 FunctionElement mainElement = compiler.mainApp.find(MAIN); |
| 637 compiler.resolver.resolve(mainElement); | 637 compiler.resolver.resolve(mainElement); |
| 638 Expect.equals(0, compiler.warnings.length); | 638 Expect.equals(0, compiler.warnings.length); |
| 639 Expect.equals(1, compiler.errors.length); | 639 Expect.equals(2, compiler.errors.length); |
| 640 Expect.equals(MessageKind.CYCLIC_CLASS_HIERARCHY, | 640 Expect.equals(MessageKind.CYCLIC_CLASS_HIERARCHY, |
| 641 compiler.errors[0].message.kind); | 641 compiler.errors[0].message.kind); |
| 642 Expect.equals(MessageKind.CANNOT_FIND_CONSTRUCTOR, |
| 643 compiler.errors[1].message.kind); |
| 642 | 644 |
| 643 compiler = new MockCompiler(); | 645 compiler = new MockCompiler(); |
| 644 compiler.parseScript("""abstract class A extends B {} | 646 compiler.parseScript("""abstract class A extends B {} |
| 645 abstract class B extends A {} | 647 abstract class B extends A {} |
| 646 class C implements A {} | 648 class C implements A {} |
| 647 main() { return new C(); }"""); | 649 main() { return new C(); }"""); |
| 648 mainElement = compiler.mainApp.find(MAIN); | 650 mainElement = compiler.mainApp.find(MAIN); |
| 649 compiler.resolver.resolve(mainElement); | 651 compiler.resolver.resolve(mainElement); |
| 650 Expect.equals(0, compiler.warnings.length); | 652 Expect.equals(0, compiler.warnings.length); |
| 651 Expect.equals(1, compiler.errors.length); | 653 Expect.equals(1, compiler.errors.length); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 } | 897 } |
| 896 main() { | 898 main() { |
| 897 new A() == new B(); | 899 new A() == new B(); |
| 898 }"""; | 900 }"""; |
| 899 final compiler = compileScript(script); | 901 final compiler = compileScript(script); |
| 900 Expect.equals(1, compiler.warnings.length); | 902 Expect.equals(1, compiler.warnings.length); |
| 901 Expect.equals(MessageKind.OVERRIDE_EQUALS_NOT_HASH_CODE, | 903 Expect.equals(MessageKind.OVERRIDE_EQUALS_NOT_HASH_CODE, |
| 902 compiler.warnings[0].message.kind); | 904 compiler.warnings[0].message.kind); |
| 903 Expect.equals(0, compiler.errors.length); | 905 Expect.equals(0, compiler.errors.length); |
| 904 } | 906 } |
| OLD | NEW |