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

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

Issue 10665014: Issue 3712. Infer closure parameters, 2-nd pass (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
« 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 00ad1532e4e2965e4305b3062460ae530628f81f..5cfdaf7debcef77a4b46617e112c101bcbddc9d4 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -2231,6 +2231,28 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
"");
assertInferredElementTypeString(libraryResult, "v", "Event");
}
+
+ /**
+ * We should infer closure parameter types even in {@link FunctionType} is specified directly,
+ * without using {@link FunctionAliasType}.
+ */
+ public void test_typesPropagation_parameterOfClosure_functionType() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class Event {}",
+ "class Button<T> {",
+ " onClick(listener(T e)) {",
+ " }",
+ "}",
+ "main() {",
+ " var button = new Button<Event>();",
+ " button.onClick((e) {",
+ " var v = e;",
+ " });",
+ "}",
+ "");
+ assertInferredElementTypeString(libraryResult, "v", "Event");
+ }
public void test_getType_binaryExpression() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
« 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