COMMA_IN_WHEN_CONDITION_WITHOUT_ARGUMENT is an ERROR now.

Migrated code.
Updated test data in IDE tests.
Dropped whenWithRangeTestsAndMultiConditions.kt:
"Introduce subject" is not applicable to 'when' with ||-ed conditions.
This commit is contained in:
Dmitry Petrov
2015-12-10 12:12:44 +03:00
parent 199827635f
commit 0fe74a8b43
26 changed files with 36 additions and 58 deletions
@@ -170,8 +170,8 @@ public object UsageTypeUtils {
} ->
if (descriptor is ConstructorDescriptor) CLASS_NEW_OPERATOR else FUNCTION_CALL
refExpr.getParentOfTypeAndBranch<KtBinaryExpression>(){ getOperationReference() } != null,
refExpr.getParentOfTypeAndBranch<KtUnaryExpression>(){ getOperationReference() } != null,
refExpr.getParentOfTypeAndBranch<KtBinaryExpression>(){ getOperationReference() } != null ||
refExpr.getParentOfTypeAndBranch<KtUnaryExpression>(){ getOperationReference() } != null ||
refExpr.getParentOfTypeAndBranch<KtWhenConditionInRange>(){ getOperationReference() } != null ->
FUNCTION_CALL
@@ -195,7 +195,7 @@ public object UsageTypeUtils {
return when (descriptor) {
is ClassifierDescriptor -> when {
// Treat object accesses as variables to simulate the old behaviour (when variables were created for objects)
DescriptorUtils.isNonCompanionObject(descriptor), DescriptorUtils.isEnumEntry(descriptor) -> getVariableUsageType()
DescriptorUtils.isNonCompanionObject(descriptor) || DescriptorUtils.isEnumEntry(descriptor) -> getVariableUsageType()
DescriptorUtils.isCompanionObject(descriptor) -> COMPANION_OBJECT_ACCESS
else -> getClassUsageType()
}