inlined 'getType' method without 'DataFlowInfo' parameter
This commit is contained in:
@@ -220,7 +220,7 @@ public class BodyResolver {
|
||||
JetScope scope = scopeForConstructor == null
|
||||
? descriptor.getScopeForMemberResolution()
|
||||
: scopeForConstructor;
|
||||
JetType type = typeInferrer.getType(scope, delegateExpression, NO_EXPECTED_TYPE, trace);
|
||||
JetType type = typeInferrer.getType(scope, delegateExpression, NO_EXPECTED_TYPE, DataFlowInfo.EMPTY, trace);
|
||||
if (type != null && supertype != null && !JetTypeChecker.INSTANCE.isSubtypeOf(type, supertype)) {
|
||||
trace.report(TYPE_MISMATCH.on(delegateExpression, supertype, type));
|
||||
}
|
||||
@@ -361,7 +361,7 @@ public class BodyResolver {
|
||||
assert primaryConstructor != null;
|
||||
final JetScope scopeForInitializers = classDescriptor.getScopeForInitializers();
|
||||
for (JetClassInitializer anonymousInitializer : anonymousInitializers) {
|
||||
expressionTypingServices.getType(scopeForInitializers, anonymousInitializer.getBody(), NO_EXPECTED_TYPE, trace);
|
||||
expressionTypingServices.getType(scopeForInitializers, anonymousInitializer.getBody(), NO_EXPECTED_TYPE, DataFlowInfo.EMPTY, trace);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -572,7 +572,7 @@ public class BodyResolver {
|
||||
//JetFlowInformationProvider flowInformationProvider = context.getDescriptorResolver().computeFlowData(property, initializer); // TODO : flow JET-15
|
||||
JetType expectedTypeForInitializer = property.getPropertyTypeRef() != null ? propertyDescriptor.getType() : NO_EXPECTED_TYPE;
|
||||
JetScope propertyDeclarationInnerScope = descriptorResolver.getPropertyDeclarationInnerScope(scope, propertyDescriptor.getTypeParameters(), ReceiverDescriptor.NO_RECEIVER, trace);
|
||||
JetType type = expressionTypingServices.getType(propertyDeclarationInnerScope, initializer, expectedTypeForInitializer, trace);
|
||||
JetType type = expressionTypingServices.getType(propertyDeclarationInnerScope, initializer, expectedTypeForInitializer, DataFlowInfo.EMPTY, trace);
|
||||
//
|
||||
// JetType expectedType = propertyDescriptor.getInType();
|
||||
// if (expectedType == null) {
|
||||
@@ -628,7 +628,7 @@ public class BodyResolver {
|
||||
JetParameter jetParameter = valueParameters.get(i);
|
||||
JetExpression defaultValue = jetParameter.getDefaultValue();
|
||||
if (defaultValue != null) {
|
||||
expressionTypingServices.getType(declaringScope, defaultValue, valueParameterDescriptor.getType(), trace);
|
||||
expressionTypingServices.getType(declaringScope, defaultValue, valueParameterDescriptor.getType(), DataFlowInfo.EMPTY, trace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -670,7 +670,7 @@ public class CallResolver {
|
||||
}
|
||||
|
||||
for (JetExpression expression : context.call.getFunctionLiteralArguments()) {
|
||||
expressionTypingServices.getType(context.scope, expression, NO_EXPECTED_TYPE, context.trace);
|
||||
expressionTypingServices.getType(context.scope, expression, NO_EXPECTED_TYPE, context.dataFlowInfo, context.trace);
|
||||
}
|
||||
|
||||
for (JetTypeProjection typeProjection : context.call.getTypeArguments()) {
|
||||
|
||||
+1
-6
@@ -106,7 +106,7 @@ public class ExpressionTypingServices {
|
||||
this.typeResolver = typeResolver;
|
||||
}
|
||||
|
||||
public JetType safeGetType(@NotNull JetScope scope, @NotNull JetExpression expression, @NotNull JetType expectedType, @NotNull DataFlowInfo dataFlowInfo, BindingTrace trace) {
|
||||
public JetType safeGetType(@NotNull JetScope scope, @NotNull JetExpression expression, @NotNull JetType expectedType, @NotNull DataFlowInfo dataFlowInfo, @NotNull BindingTrace trace) {
|
||||
JetType type = getType(scope, expression, expectedType, dataFlowInfo, trace);
|
||||
if (type != null) {
|
||||
return type;
|
||||
@@ -114,11 +114,6 @@ public class ExpressionTypingServices {
|
||||
return ErrorUtils.createErrorType("Type for " + expression.getText());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JetType getType(@NotNull final JetScope scope, @NotNull JetExpression expression, @NotNull JetType expectedType, @NotNull BindingTrace trace) {
|
||||
return getType(scope, expression, expectedType, DataFlowInfo.EMPTY, trace);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JetType getType(@NotNull final JetScope scope, @NotNull JetExpression expression, @NotNull JetType expectedType, @NotNull DataFlowInfo dataFlowInfo, @NotNull BindingTrace trace) {
|
||||
ExpressionTypingContext context = ExpressionTypingContext.newContext(
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package a
|
||||
|
||||
fun foo() {
|
||||
val i : Int? = 42
|
||||
if (i != null) {
|
||||
<!UNRESOLVED_REFERENCE!>doSmth<!> {
|
||||
val <!UNUSED_VARIABLE!>x<!> = i + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -554,7 +554,7 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
||||
private void assertType(String expression, JetType expectedType) {
|
||||
Project project = getProject();
|
||||
JetExpression jetExpression = JetPsiFactory.createExpression(project, expression);
|
||||
JetType type = expressionTypingServices.getType(scopeWithImports, jetExpression, TypeUtils.NO_EXPECTED_TYPE, JetTestUtils.DUMMY_TRACE);
|
||||
JetType type = expressionTypingServices.getType(scopeWithImports, jetExpression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfo.EMPTY, JetTestUtils.DUMMY_TRACE);
|
||||
assertTrue(type + " != " + expectedType, type.equals(expectedType));
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
||||
private void assertType(JetScope scope, String expression, String expectedTypeStr) {
|
||||
Project project = getProject();
|
||||
JetExpression jetExpression = JetPsiFactory.createExpression(project, expression);
|
||||
JetType type = expressionTypingServices.getType(addImports(scope), jetExpression, TypeUtils.NO_EXPECTED_TYPE, JetTestUtils.DUMMY_TRACE);
|
||||
JetType type = expressionTypingServices.getType(addImports(scope), jetExpression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfo.EMPTY, JetTestUtils.DUMMY_TRACE);
|
||||
JetType expectedType = expectedTypeStr == null ? null : makeType(expectedTypeStr);
|
||||
assertEquals(expectedType, type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user