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

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

Issue 11028139: Report ~/ warning only when both arguments are integers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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
« no previous file with comments | « compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cb8a83a399bc86e5cca0af96ddbdcc243dc9d10b..961a981ee6f01a012049a91c7c0f631021526936 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -5307,11 +5307,28 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
/**
* Developers unfamiliar with Dart frequently write (x/y).toInt() instead of x ~/ y. The editor
- * should recognize that pattern
+ * should recognize that pattern.
* <p>
* http://code.google.com/p/dart/issues/detail?id=5652
*/
- public void test_useEffectiveIntegerDivision() throws Exception {
+ public void test_useEffectiveIntegerDivision_int() throws Exception {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " int x = 7;",
+ " int y = 2;",
+ " print( (x / y).toInt() );",
+ "}",
+ "");
+ assertErrors(result.getErrors(), errEx(TypeErrorCode.USE_INTEGER_DIVISION, 5, 10, 15));
+ }
+
+ /**
+ * We need to report warning only when arguments are integers.
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=5652
+ */
+ public void test_useEffectiveIntegerDivision_num() throws Exception {
AnalyzeLibraryResult result = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"main() {",
@@ -5320,6 +5337,6 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
" print( (x / y).toInt() );",
"}",
"");
- assertErrors(result.getErrors(), errEx(TypeErrorCode.USE_INTEGER_DIVISION, 5, 10, 15));
+ assertErrors(result.getErrors());
}
}
« no previous file with comments | « compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698