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

Unified Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java

Issue 10700089: Another round of JUnit tests to finish off ResovlerErrorCodes I could reproduce (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
index ba49389744712ae7140f92c98472e09b719b7e26..cba5892d4dbcdcf5cdfad2494c178405a81e587a 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -1721,6 +1721,20 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertErrors(result.getErrors(), errEx(TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE, 4, 22, 1));
}
+ public void test_typeVariableBoundsCheckNew() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "class Object {}",
+ "class A { }",
+ "class B { }",
+ "class C<T extends A> { }",
+ "method() {",
+ " new C<B>();", // B not assignable to A
+ "}");
+ assertErrors(
+ libraryResult.getErrors(),
+ errEx(TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE, 6, 9, 1));
+ }
+
/**
* When we check getter/setter compatibility, we should compare propagated type variables.
* <p>
@@ -3166,6 +3180,17 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
errEx(TypeErrorCode.OVERRIDING_STATIC_MEMBER, 8, 3, 3));
}
+ public void test_rethrowNotInCatch() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "class Object {}",
+ "method() {",
+ " throw;",
+ "}");
+ assertErrors(
+ libraryResult.getErrors(),
+ errEx(ResolverErrorCode.RETHROW_NOT_IN_CATCH, 3, 3, 6));
+ }
+
private static <T extends DartNode> T findNode(
AnalyzeLibraryResult libraryResult,
final Class<T> clazz,

Powered by Google App Engine
This is Rietveld 408576698