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

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

Issue 10546161: Issue 3516. Make displaying warning for inferred types configurable (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 a2be1b4283495c302d38a0f88c677e700a060c4d..85013943b20462895ce8c79135587cb515855262 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -3,16 +3,21 @@
// BSD-style license that can be found in the LICENSE file.
package com.google.dart.compiler.type;
+import static com.google.dart.compiler.common.ErrorExpectation.assertErrors;
+import static com.google.dart.compiler.common.ErrorExpectation.errEx;
+
import com.google.common.base.Joiner;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import com.google.dart.compiler.CommandLineOptions.CompilerOptions;
import com.google.dart.compiler.CompilerTestCase;
import com.google.dart.compiler.DartArtifactProvider;
import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.DartCompiler;
import com.google.dart.compiler.DartCompilerErrorCode;
import com.google.dart.compiler.DartCompilerListener;
+import com.google.dart.compiler.DefaultCompilerConfiguration;
import com.google.dart.compiler.MockArtifactProvider;
import com.google.dart.compiler.MockLibrarySource;
import com.google.dart.compiler.ast.ASTVisitor;
@@ -40,9 +45,6 @@ import com.google.dart.compiler.resolver.NodeElement;
import com.google.dart.compiler.resolver.ResolverErrorCode;
import com.google.dart.compiler.resolver.TypeErrorCode;
-import static com.google.dart.compiler.common.ErrorExpectation.assertErrors;
-import static com.google.dart.compiler.common.ErrorExpectation.errEx;
-
import java.io.Reader;
import java.io.StringReader;
import java.net.URI;
@@ -1590,6 +1592,52 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertErrors(result.getErrors());
}
+ public void test_inferredTypes_noMemberWarnigs() throws Exception {
Brian Wilkerson 2012/06/14 15:03:21 nit: "Warnigs" --> "Warnings"
+ // report by default
+ {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {}",
+ "class B extends A {",
+ " var f;",
+ " m() {}",
+ "}",
+ "foo(A a) {",
+ " var v = a;",
+ " v.f = 0;",
+ " v.m();",
+ "}",
+ "");
+ assertErrors(
+ result.getErrors(),
+ errEx(TypeErrorCode.NOT_A_MEMBER_OF, 9, 5, 1),
+ errEx(TypeErrorCode.INTERFACE_HAS_NO_METHOD_NAMED, 10, 3, 5));
+ }
+ // use CompilerConfiguration
+ {
+ compilerConfiguration = new DefaultCompilerConfiguration(new CompilerOptions() {
+ @Override
+ public boolean suppressNoMemberWarningForInferredTypes() {
+ return true;
+ }
+ });
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {}",
+ "class B extends A {",
+ " var f;",
+ " m() {}",
+ "}",
+ "foo(A a) {",
+ " var v = a;",
+ " v.f = 0;",
+ " v.m();",
+ "}",
+ "");
+ assertErrors(result.getErrors());
+ }
+ }
+
public void test_typesPropagation_assignAtDeclaration() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"f() {",

Powered by Google App Engine
This is Rietveld 408576698