Override/Implement Members: Support all nullability annotations respected by the Kotlin compiler

#KT-12704 Fixed
 #KT-15583 Fixed
This commit is contained in:
Alexey Sedunov
2017-01-10 20:07:03 +03:00
parent d94243ac7b
commit 862966fd33
8 changed files with 57 additions and 6 deletions
@@ -31,10 +31,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
import org.jetbrains.kotlin.resolve.scopes.utils.findClassifier
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.builtIns
import org.jetbrains.kotlin.types.typeUtil.immediateSupertypes
import org.jetbrains.kotlin.types.typeUtil.substitute
import org.jetbrains.kotlin.types.typeUtil.supertypes
import org.jetbrains.kotlin.types.typeUtil.*
import org.jetbrains.kotlin.utils.SmartSet
import org.jetbrains.kotlin.utils.addToStdlib.singletonList
@@ -68,7 +65,7 @@ private fun KotlinType.approximateNonDynamicFlexibleTypes(
approximation = approximation.approximateNonDynamicFlexibleTypes()
approximation = if (isAnnotatedNotNull()) approximation.makeNullableAsSpecified(false) else approximation
approximation = if (nullability() == TypeNullability.NOT_NULL) approximation.makeNullableAsSpecified(false) else approximation
if (approximation.isMarkedNullable && !flexible.lowerBound.isMarkedNullable && TypeUtils.isTypeParameter(approximation) && TypeUtils.hasNullableSuperType(approximation)) {
approximation = approximation.makeNullableAsSpecified(false)