From 924e70f3f79ad390a4859f1f9a6df8066f1d79ba Mon Sep 17 00:00:00 2001 From: Jack Zhou Date: Sun, 12 May 2013 21:15:44 -0400 Subject: [PATCH] Create from usage: Fixed offering error types when guessing type fails. --- .../jet/plugin/quickfix/CreateFunctionFromUsageFix.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/CreateFunctionFromUsageFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/CreateFunctionFromUsageFix.java index 5bc985a1b3a..44edb4870b9 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/CreateFunctionFromUsageFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/CreateFunctionFromUsageFix.java @@ -1209,6 +1209,12 @@ public class CreateFunctionFromUsageFix extends CreateFromUsageFixBase { } if (expectedTypes.isEmpty()) { return new JetType[0]; // can't guess + } else { + for (JetType expectedType : expectedTypes) { + if (ErrorUtils.containsErrorType(expectedType)) { + return new JetType[0]; // guessing resulted in an error + } + } } JetType type = TypeUtils.intersect(JetTypeChecker.INSTANCE, expectedTypes); if (type != null) {