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

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

Issue 11348139: Issue 6776. Infer sub-type member only if there is only one candidate. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/InterfaceTypeImplementation.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 9c64e0bd76a816b792617b0e0a2aafd49019b18b..fb286ba965d84a8023a423a21b56d076d42e5ca8 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -5496,6 +5496,41 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
}
/**
+ * We should resolve sub-type member only if there is only sub-type with such member.
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=6776
+ */
+ public void test_trySubTypeMember_moreThanOneMember() throws Exception {
+ compilerConfiguration = new DefaultCompilerConfiguration(new CompilerOptions() {
+ @Override
+ public boolean typeChecksForInferredTypes() {
+ return true;
+ }
+ });
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class Event {}",
+ "class MouseEvent extends Event {",
+ " int clientX;",
+ "}",
+ "class ScreenEvent extends Event {",
+ " int clientX;",
+ "}",
+ "typedef Listener(Event event);",
+ "class Button {",
+ " addListener(Listener listener) {}",
+ "}",
+ "main() {",
+ " Button button = new Button();",
+ " button.addListener((event) {",
+ " event.clientX;",
+ " });",
+ "}",
+ "");
+ assertErrors(result.getErrors(), errEx(TypeErrorCode.NOT_A_MEMBER_OF_INFERRED, 16, 11, 7));
+ }
+
+ /**
* <p>
* http://code.google.com/p/dart/issues/detail?id=6491
*/
« no previous file with comments | « compiler/java/com/google/dart/compiler/type/InterfaceTypeImplementation.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698