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

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

Issue 8948001: Updates dartc to recognize 'default' keyword on interface and updated factory method syntax (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Feedback from mmendez Created 9 years 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/TypeAnalyzerTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java
index 69040345ef633498e735fb6d97a2b4592592f202..142897559af6aba305d350f5ba7686529e6d3370 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java
@@ -814,11 +814,11 @@ public class TypeAnalyzerTest extends TypeAnalyzerTestCase {
" Foo.foo() {}",
" Foo.bar([int i = null]) {}",
"}",
- "interface Bar<T> factory Baz {",
+ "interface Bar<T> factory Baz<T> {",
" Bar.make();",
"}",
- "class Baz {",
- " factory Bar<S>.make(S x) { return null; }",
+ "class Baz<T> {",
+ " factory Bar.make(T x) { return null; }",
"}"));
analyze("Foo x = new Foo(0);");
@@ -834,7 +834,21 @@ public class TypeAnalyzerTest extends TypeAnalyzerTestCase {
analyzeFail("Foo x = new Foo.bar('');", TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE);
analyzeFail("Foo x = new Foo.bar(0, null);", TypeErrorCode.EXTRA_ARGUMENT);
- analyze("Bar<String> x = new Bar<String>.make('');");
+ analyze("Bar<String> x = new Bar.make('');");
+ }
+
+ public void testAssignableTypeArg() {
+ analyzeClasses(loadSource(
+ "interface Bar<T> factory Baz<T> {",
+ " Bar.make();",
+ "}",
+ "class Baz<T> {",
+ " Baz(T x) { return null; }",
+ " factory Bar.make(T x) { return null; }",
+ "}"));
+ analyze("Baz<String> x = new Baz<String>('');");
+ analyze("Bar<String> x = new Bar.make('');");
+ analyze("Bar<String> x = new Bar<String>.make('');");
}
public void testOddStuff() {
@@ -1095,6 +1109,16 @@ public class TypeAnalyzerTest extends TypeAnalyzerTestCase {
analyzeIn(cls, "foo() { T t = true; }()", 1);
}
+ public void testDefaultTypeArgs() {
+ Map<String, ClassElement> source = loadSource(
+ "class Object{}",
+ "interface List<T> {}",
+ "interface A<K,V> default B<K, V extends List<K>> {}",
+ "class B<K, V extends List<K>> {",
+ "}");
+ analyzeClasses(source);
+ }
+
public void testUnaryOperators() {
Map<String, ClassElement> source = loadSource(
"class Foo {",

Powered by Google App Engine
This is Rietveld 408576698