Create from usage: Fixed offering error types when guessing type fails.

This commit is contained in:
Jack Zhou
2013-05-12 21:15:44 -04:00
parent 5bd144313d
commit 924e70f3f7
@@ -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) {