NI: discard def not null types if they appear in return positions, in inv or in variance
^KT-37343 Fixed
This commit is contained in:
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
||||
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||
import org.jetbrains.kotlin.types.AbstractTypeCheckerContext
|
||||
import org.jetbrains.kotlin.types.checker.NewCapturedType
|
||||
import org.jetbrains.kotlin.types.model.*
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.cast
|
||||
|
||||
@@ -267,6 +268,16 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
|
||||
return this.constructor.typeParameterMarker
|
||||
}
|
||||
|
||||
override fun CapturedTypeMarker.withNotNullProjection(): KotlinTypeMarker {
|
||||
require(this is ConeCapturedType)
|
||||
return this // TODO
|
||||
}
|
||||
|
||||
override fun CapturedTypeMarker.isProjectionNotNull(): Boolean {
|
||||
require(this is ConeCapturedType)
|
||||
return false // TODO
|
||||
}
|
||||
|
||||
override fun DefinitelyNotNullTypeMarker.original(): SimpleTypeMarker {
|
||||
require(this is ConeDefinitelyNotNullType)
|
||||
return this.original as SimpleTypeMarker
|
||||
|
||||
Generated
+10
@@ -10725,6 +10725,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/inference/constraints/constraintOnFunctionLiteral.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definitelyNotNullTypeInArguments.kt")
|
||||
public void testDefinitelyNotNullTypeInArguments() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definitelyNotNullTypeInReturnPosition.kt")
|
||||
public void testDefinitelyNotNullTypeInReturnPosition() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definitelyNotNullTypeInvariantPosition.kt")
|
||||
public void testDefinitelyNotNullTypeInvariantPosition() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInvariantPosition.kt");
|
||||
|
||||
Reference in New Issue
Block a user