Create from usage: Renamed guessTypeForExpression to guessTypesForExpression.
This commit is contained in:
@@ -237,7 +237,7 @@ public class CreateFunctionFromUsageFix extends CreateFromUsageFixBase {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert expressionOfType != null : "!isType() means type == null && expressionOfType != null";
|
assert expressionOfType != null : "!isType() means type == null && expressionOfType != null";
|
||||||
for (JetType type : guessTypeForExpression(expressionOfType, context)) {
|
for (JetType type : guessTypesForExpression(expressionOfType, context)) {
|
||||||
types.add(type);
|
types.add(type);
|
||||||
if (variance == Variance.IN_VARIANCE) {
|
if (variance == Variance.IN_VARIANCE) {
|
||||||
types.addAll(TypeUtils.getAllSupertypes(type));
|
types.addAll(TypeUtils.getAllSupertypes(type));
|
||||||
@@ -1137,7 +1137,7 @@ public class CreateFunctionFromUsageFix extends CreateFromUsageFixBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static JetType[] guessTypeForExpression(@NotNull JetExpression expr, @NotNull BindingContext context) {
|
private static JetType[] guessTypesForExpression(@NotNull JetExpression expr, @NotNull BindingContext context) {
|
||||||
JetType type = context.get(BindingContext.EXPRESSION_TYPE, expr);
|
JetType type = context.get(BindingContext.EXPRESSION_TYPE, expr);
|
||||||
|
|
||||||
// if we know the actual type of the expression
|
// if we know the actual type of the expression
|
||||||
@@ -1350,7 +1350,7 @@ public class CreateFunctionFromUsageFix extends CreateFromUsageFixBase {
|
|||||||
JetType returnJetType = KotlinBuiltIns.getInstance().getIterator().getDefaultType();
|
JetType returnJetType = KotlinBuiltIns.getInstance().getIterator().getDefaultType();
|
||||||
|
|
||||||
BindingContext context = AnalyzerFacadeWithCache.analyzeFileWithCache(jetFile).getBindingContext();
|
BindingContext context = AnalyzerFacadeWithCache.analyzeFileWithCache(jetFile).getBindingContext();
|
||||||
JetType[] returnJetTypeParameterTypes = guessTypeForExpression(variableExpr, context);
|
JetType[] returnJetTypeParameterTypes = guessTypesForExpression(variableExpr, context);
|
||||||
if (returnJetTypeParameterTypes.length != 1) return null;
|
if (returnJetTypeParameterTypes.length != 1) return null;
|
||||||
|
|
||||||
TypeProjection returnJetTypeParameterType = new TypeProjection(returnJetTypeParameterTypes[0]);
|
TypeProjection returnJetTypeParameterType = new TypeProjection(returnJetTypeParameterTypes[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user