[FE 1.0] Fix reporting of non exhaustive when statement for whens with subject
^KT-48653 Fixed
This commit is contained in:
+1
-4
@@ -1002,7 +1002,7 @@ class ControlFlowInformationProviderImpl private constructor(
|
||||
trace.report(EXPECT_TYPE_IN_WHEN_WITHOUT_ELSE.on(element, it.typeOfDeclaration))
|
||||
}
|
||||
} else if (subjectExpression != null) {
|
||||
val subjectType = trace.getType(subjectExpression)
|
||||
val subjectType = WhenChecker.whenSubjectType(element, trace.bindingContext)
|
||||
if (elseEntry != null) {
|
||||
if (missingCases.isEmpty() && subjectType != null && !subjectType.isFlexible()) {
|
||||
val subjectClass = subjectType.constructor.declarationDescriptor as? ClassDescriptor
|
||||
@@ -1016,9 +1016,6 @@ class ControlFlowInformationProviderImpl private constructor(
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
if (!usedAsExpression) {
|
||||
|
||||
}
|
||||
if (!usedAsExpression) {
|
||||
if (languageVersionSettings.supportsFeature(LanguageFeature.WarnAboutNonExhaustiveWhenOnAlgebraicTypes)) {
|
||||
|
||||
Reference in New Issue
Block a user