Provide additional information about missing supertypes
Add -X flag to report extra compiler diagnostics which migth break compatibility. Use the flag to unconditionally check constructors without fear of prematurely evaluating lazy supertypes. KT-19234 KT-42404 KT-44583
This commit is contained in:
+6
-1
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.resolve.checkers
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
@@ -48,7 +49,11 @@ object MissingDependencySupertypeChecker {
|
||||
descriptor.dispatchReceiverParameter?.declaration, reportOn,
|
||||
context.trace, context.missingSupertypesResolver
|
||||
)
|
||||
if (descriptor !is ConstructorDescriptor && descriptor !is FakeCallableDescriptorForObject && !errorReported) {
|
||||
|
||||
val eagerChecksAllowed = context.languageVersionSettings.supportsFeature(LanguageFeature.ExtendedCompilerChecks)
|
||||
val unresolvedLazySupertypesByDefault = descriptor is ConstructorDescriptor || descriptor is FakeCallableDescriptorForObject
|
||||
|
||||
if (eagerChecksAllowed || !unresolvedLazySupertypesByDefault && !errorReported) {
|
||||
// The constructed class' own supertypes are not resolved after constructor call,
|
||||
// so its containing declaration should not be checked.
|
||||
// Dispatch receiver is checked before for case of inner class constructor call.
|
||||
|
||||
Reference in New Issue
Block a user