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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/completion/CompletionEngineTest.java

Issue 10417044: Type inference in if, while, for and for-in statements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changes for review comments Created 8 years, 7 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: editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/completion/CompletionEngineTest.java
diff --git a/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/completion/CompletionEngineTest.java b/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/completion/CompletionEngineTest.java
index 9aa1d46454dbfadcc78f5477c98fc31e579f118b..898fa369aaa9ce885a2b4df39c68c8c8e668ed26 100644
--- a/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/completion/CompletionEngineTest.java
+++ b/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/completion/CompletionEngineTest.java
@@ -13,6 +13,7 @@
*/
package com.google.dart.tools.core.internal.completion;
+import com.google.common.base.Joiner;
import com.google.dart.tools.core.DartCoreDebug;
import com.google.dart.tools.core.analysis.AnalysisTestUtilities;
import com.google.dart.tools.core.internal.index.impl.InMemoryIndex;
@@ -233,21 +234,15 @@ public class CompletionEngineTest extends TestCase {
}
public void testCommentSnippets033() throws Exception {
- if (DartCoreDebug.ENABLE_TYPE_REFINEMENT) {
- test("t1() {var x;if (x is List) {x.!1add(3);}}", "1+add", "1+length");
- }
+ test("t1() {var x;if (x is List) {x.!1add(3);}}", "1+add", "1+length");
}
public void testCommentSnippets034() throws Exception {
- if (DartCoreDebug.ENABLE_TYPE_REFINEMENT) {
- test("t2() {var q=[0],z=q.!1length;q.!2isEmpty();}", "1+length", "2+isEmpty");
- }
+ test("t2() {var q=[0],z=q.!1length;q.!2isEmpty();}", "1+length", "2+isEmpty");
}
public void testCommentSnippets035() throws Exception {
- if (DartCoreDebug.ENABLE_TYPE_REFINEMENT) {
- test("t3() {var x=new List(), y=x.!1length();x.!2isEmpty();}", "1+length", "2+isEmpty");
- }
+ test("t3() {var x=new List(), y=x.!1length();x.!2isEmpty();}", "1+length", "2+isEmpty");
}
public void testCommentSnippets036() throws Exception {
@@ -320,39 +315,65 @@ public class CompletionEngineTest extends TestCase {
}
public void testCommentSnippets051() throws Exception {
- if (DartCoreDebug.ENABLE_TYPE_REFINEMENT) {
- test(
- "void r() {var l = new List.from(['a','b','c']);l.!1length;for (var q in l) {if (q is String) {l.!2length;}}}",
- "1+length",
- "2+value");
- }
+ String source = Joiner.on("\n").join(
+ "void r() {",
+ " var l = new List.from(['a','b','c']);",
+ " l.!1length;",
+ " for (var v in l) {",
+ " if (v is String) {",
+ " v.!2length;",
+ " v.!3getKeys;",
+ " }",
+ " }",
+ "}");
+ test(source, "1+length", "2+length", "3-getKeys");
}
public void testCommentSnippets052() throws Exception {
- if (DartCoreDebug.ENABLE_TYPE_REFINEMENT) {
- test(
- "void r() {var l = new List.from(['a','b','c']);l.!1length;for (int i=i;i<2;i++) {if (q is String) {l.!2length;}}}",
- "1+length",
- "2+value");
- }
+ String source = Joiner.on("\n").join(
+ "void r() {",
+ " List<String> values = ['a','b','c'];",
+ " for (var v in values) {",
+ " v.!1toUpperCase;",
+ " v.!2getKeys;",
+ " }",
+ "}");
+ test(source, "1+toUpperCase", "2-getKeys");
}
public void testCommentSnippets053() throws Exception {
- if (DartCoreDebug.ENABLE_TYPE_REFINEMENT) {
- test(
- "void r() {var l = new List.from(['a','b','c']);l.!1length;while (true) {if (q is String) {l.!2length;}}}",
- "1+length",
- "2+value");
- }
+ String source = Joiner.on("\n").join(
+ "void r() {",
+ " var v;",
+ " while (v is String) {",
+ " v.!1toUpperCase;",
+ " v.!2getKeys;",
+ " }",
+ "}");
+ test(source, "1+toUpperCase", "2-getKeys");
}
public void testCommentSnippets054() throws Exception {
- if (DartCoreDebug.ENABLE_TYPE_REFINEMENT) {
- test(
- "void r() {var l = new List.from(['a','b','c']);l.!1length;do {if (q is String) {l.!2length;}}while (true);}",
- "1+length",
- "2+value");
- }
+ String source = Joiner.on("\n").join(
+ "void r() {",
+ " var v;",
+ " for (; v is String; v.!1isEmpty) {",
+ " v.!2toUpperCase;",
+ " v.!3getKeys;",
+ " }",
+ "}");
+ test(source, "1+isEmpty", "2+toUpperCase", "3-getKeys");
+ }
+
+ public void testCommentSnippets055() throws Exception {
+ String source = Joiner.on("\n").join(
+ "void r() {",
+ " String v;",
+ " if (v is Object) {",
+ " v.!1toUpperCase;",
+ " }",
+ "}");
+ test(source, "1+toUpperCase");
}
public void testCompletion_alias_field() throws Exception {

Powered by Google App Engine
This is Rietveld 408576698