OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 package com.google.dart.compiler.type; | 5 package com.google.dart.compiler.type; |
6 | 6 |
7 import com.google.common.base.Joiner; | 7 import com.google.common.base.Joiner; |
8 import com.google.common.io.CharStreams; | 8 import com.google.common.io.CharStreams; |
9 import com.google.dart.compiler.DartCompilerErrorCode; | 9 import com.google.dart.compiler.DartCompilerErrorCode; |
10 import com.google.dart.compiler.ErrorCode; | 10 import com.google.dart.compiler.ErrorCode; |
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 analyzeFail("void f([int x = '']) {}", DartCompilerErrorCode.TYPE_NOT_ASSIGN
MENT_COMPATIBLE); | 1209 analyzeFail("void f([int x = '']) {}", DartCompilerErrorCode.TYPE_NOT_ASSIGN
MENT_COMPATIBLE); |
1210 | 1210 |
1211 analyze("{ int x = 1; }"); | 1211 analyze("{ int x = 1; }"); |
1212 analyzeFail("{ int x = ''; }", DartCompilerErrorCode.TYPE_NOT_ASSIGNMENT_COM
PATIBLE); | 1212 analyzeFail("{ int x = ''; }", DartCompilerErrorCode.TYPE_NOT_ASSIGNMENT_COM
PATIBLE); |
1213 } | 1213 } |
1214 | 1214 |
1215 public void testInitializedFields() { | 1215 public void testInitializedFields() { |
1216 Map<String, ClassElement> classes = loadSource( | 1216 Map<String, ClassElement> classes = loadSource( |
1217 "class GoodField {", | 1217 "class GoodField {", |
1218 " static final int i = 1;", | 1218 " static final int i = 1;", |
1219 "}", | |
1220 "class BadField {", | |
1221 " static final int i = '';", | |
1222 "}"); | 1219 "}"); |
1223 analyzeClass(classes.get("GoodField"), 0); | 1220 analyzeClass(classes.get("GoodField"), 0); |
1224 analyzeClass(classes.get("BadField"), 1); | 1221 |
| 1222 // Note, the TypeAnalyzer doesn't get a chance |
| 1223 // to get its hands on bad initializers anymore |
| 1224 // due to type checking in CompileTimeConstVisitor. |
1225 } | 1225 } |
1226 | 1226 |
1227 public void testGetAllSupertypes() | 1227 public void testGetAllSupertypes() |
1228 throws CyclicDeclarationException, DuplicatedInterfaceException { | 1228 throws CyclicDeclarationException, DuplicatedInterfaceException { |
1229 Map<String, ClassElement> classes = loadSource( | 1229 Map<String, ClassElement> classes = loadSource( |
1230 "class A extends B<String> {", | 1230 "class A extends B<String> {", |
1231 "}", | 1231 "}", |
1232 "class B<T> extends C<G<T>> implements I<int>, I1<T> {", | 1232 "class B<T> extends C<G<T>> implements I<int>, I1<T> {", |
1233 "}", | 1233 "}", |
1234 "class C<U> {", | 1234 "class C<U> {", |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 public InterfaceType getStringImplementationType() { | 1613 public InterfaceType getStringImplementationType() { |
1614 throw new AssertionError(); | 1614 throw new AssertionError(); |
1615 } | 1615 } |
1616 | 1616 |
1617 @Override | 1617 @Override |
1618 public InterfaceType getIsolateType() { | 1618 public InterfaceType getIsolateType() { |
1619 throw new AssertionError(); | 1619 throw new AssertionError(); |
1620 } | 1620 } |
1621 } | 1621 } |
1622 } | 1622 } |
OLD | NEW |