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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 compiler.parseScript('class Foo<T, U> {}'); | 145 compiler.parseScript('class Foo<T, U> {}'); |
146 compiler.resolveStatement('Foo<notype, int> x;'); | 146 compiler.resolveStatement('Foo<notype, int> x;'); |
147 Expect.equals(1, compiler.warnings.length); | 147 Expect.equals(1, compiler.warnings.length); |
148 Expect.equals(MessageKind.CANNOT_RESOLVE_TYPE.warning, | 148 Expect.equals(MessageKind.CANNOT_RESOLVE_TYPE.warning, |
149 compiler.warnings[0].message.kind); | 149 compiler.warnings[0].message.kind); |
150 Expect.equals(0, compiler.errors.length); | 150 Expect.equals(0, compiler.errors.length); |
151 | 151 |
152 compiler = new MockCompiler(); | 152 compiler = new MockCompiler(); |
153 compiler.parseScript('class Foo<T, U> {}'); | 153 compiler.parseScript('class Foo<T, U> {}'); |
154 compiler.resolveStatement('var x = new Foo<notype, int>();'); | 154 compiler.resolveStatement('var x = new Foo<notype, int>();'); |
155 Expect.equals(0, compiler.warnings.length); | 155 Expect.equals(1, compiler.warnings.length); |
156 Expect.equals(1, compiler.errors.length); | 156 Expect.equals(0, compiler.errors.length); |
157 Expect.equals(MessageKind.CANNOT_RESOLVE_TYPE.error, | 157 Expect.equals(MessageKind.CANNOT_RESOLVE_TYPE.warning, |
158 compiler.errors[0].message.kind); | 158 compiler.warnings[0].message.kind); |
159 | 159 |
160 compiler = new MockCompiler(); | 160 compiler = new MockCompiler(); |
161 compiler.parseScript('class Foo<T> {' | 161 compiler.parseScript('class Foo<T> {' |
162 ' Foo<T> t;' | 162 ' Foo<T> t;' |
163 ' foo(Foo<T> f) {}' | 163 ' foo(Foo<T> f) {}' |
164 ' bar() { g(Foo<T> f) {}; g(); }' | 164 ' bar() { g(Foo<T> f) {}; g(); }' |
165 '}'); | 165 '}'); |
166 foo = compiler.mainApp.find(buildSourceString('Foo')); | 166 foo = compiler.mainApp.find(buildSourceString('Foo')); |
167 foo.ensureResolved(compiler); | 167 foo.ensureResolved(compiler); |
168 foo.lookupLocalMember(buildSourceString('t')).computeType(compiler);; | 168 foo.lookupLocalMember(buildSourceString('t')).computeType(compiler);; |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 } | 898 } |
899 main() { | 899 main() { |
900 new A() == new B(); | 900 new A() == new B(); |
901 }"""; | 901 }"""; |
902 final compiler = compileScript(script); | 902 final compiler = compileScript(script); |
903 Expect.equals(1, compiler.warnings.length); | 903 Expect.equals(1, compiler.warnings.length); |
904 Expect.equals(MessageKind.OVERRIDE_EQUALS_NOT_HASH_CODE, | 904 Expect.equals(MessageKind.OVERRIDE_EQUALS_NOT_HASH_CODE, |
905 compiler.warnings[0].message.kind); | 905 compiler.warnings[0].message.kind); |
906 Expect.equals(0, compiler.errors.length); | 906 Expect.equals(0, compiler.errors.length); |
907 } | 907 } |
OLD | NEW |