Minor. Invert 'notLocal' boolean value parameter
- Mainly to avoid double negations (!notLocal) - Also swap last parameters (to allow use of named arguments)
This commit is contained in:
@@ -816,7 +816,7 @@ public class DescriptorResolver {
|
||||
LexicalScope scopeForInitializer = ScopeUtils.makeScopeForPropertyInitializer(scopeWithTypeParameters, propertyDescriptor);
|
||||
KotlinType typeIfKnown = variableTypeAndInitializerResolver.resolveTypeNullable(
|
||||
propertyDescriptor, scopeForInitializer,
|
||||
property, dataFlowInfo, true, trace
|
||||
property, dataFlowInfo, /* local = */ trace, false
|
||||
);
|
||||
|
||||
PropertyGetterDescriptorImpl getter = resolvePropertyGetterDescriptor(
|
||||
|
||||
@@ -149,10 +149,10 @@ class LocalVariableResolver(
|
||||
/* isConst = */ false
|
||||
)
|
||||
// For a local variable the type must not be deferred
|
||||
type = variableTypeAndInitializerResolver.resolveType(propertyDescriptor, scope, variable, dataFlowInfo, false, trace)
|
||||
type = variableTypeAndInitializerResolver.resolveType(propertyDescriptor, scope, variable, dataFlowInfo, trace, local = true)
|
||||
|
||||
val receiverParameter = (containingDeclaration as ScriptDescriptor).thisAsReceiverParameter
|
||||
propertyDescriptor.setType(type, emptyList<TypeParameterDescriptor>(), receiverParameter, null as? KotlinType)
|
||||
propertyDescriptor.setType(type, emptyList<TypeParameterDescriptor>(), receiverParameter, null as KotlinType?)
|
||||
initializeWithDefaultGetterSetter(propertyDescriptor)
|
||||
trace.record(BindingContext.VARIABLE, variable, propertyDescriptor)
|
||||
result = propertyDescriptor
|
||||
@@ -160,7 +160,7 @@ class LocalVariableResolver(
|
||||
else {
|
||||
val variableDescriptor = resolveLocalVariableDescriptorWithType(scope, variable, null, trace)
|
||||
// For a local variable the type must not be deferred
|
||||
type = variableTypeAndInitializerResolver.resolveType(variableDescriptor, scope, variable, dataFlowInfo, false, trace)
|
||||
type = variableTypeAndInitializerResolver.resolveType(variableDescriptor, scope, variable, dataFlowInfo, trace, local = true)
|
||||
variableDescriptor.setOutType(type)
|
||||
result = variableDescriptor
|
||||
}
|
||||
|
||||
+7
-7
@@ -53,12 +53,12 @@ class VariableTypeAndInitializerResolver(
|
||||
scopeForInitializer: LexicalScope,
|
||||
variable: KtVariableDeclaration,
|
||||
dataFlowInfo: DataFlowInfo,
|
||||
notLocal: Boolean,
|
||||
trace: BindingTrace
|
||||
trace: BindingTrace,
|
||||
local: Boolean
|
||||
): KotlinType {
|
||||
resolveTypeNullable(variableDescriptor, scopeForInitializer, variable, dataFlowInfo, notLocal, trace)?.let { return it }
|
||||
resolveTypeNullable(variableDescriptor, scopeForInitializer, variable, dataFlowInfo, trace, local)?.let { return it }
|
||||
|
||||
if (!notLocal) {
|
||||
if (local) {
|
||||
trace.report(VARIABLE_WITH_NO_TYPE_NO_INITIALIZER.on(variable))
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ class VariableTypeAndInitializerResolver(
|
||||
scopeForInitializer: LexicalScope,
|
||||
variable: KtVariableDeclaration,
|
||||
dataFlowInfo: DataFlowInfo,
|
||||
notLocal: Boolean,
|
||||
trace: BindingTrace
|
||||
trace: BindingTrace,
|
||||
local: Boolean
|
||||
): KotlinType? {
|
||||
val propertyTypeRef = variable.typeReference
|
||||
return when {
|
||||
@@ -82,7 +82,7 @@ class VariableTypeAndInitializerResolver(
|
||||
resolveDelegatedPropertyType(variable, variableDescriptor, scopeForInitializer, dataFlowInfo, trace)
|
||||
|
||||
variable.hasInitializer() -> when {
|
||||
notLocal ->
|
||||
!local ->
|
||||
DeferredType.createRecursionIntolerant(
|
||||
storageManager,
|
||||
trace
|
||||
|
||||
Reference in New Issue
Block a user