Support new form of definitely non-nullable types: T & Any
^KT-26245 In Progress
This commit is contained in:
committed by
teamcityserver
parent
cdd8d1c163
commit
302eacbf59
+70
@@ -10116,6 +10116,76 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class ExplicitDefinitelyNotNullableViaIntersection {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInExplicitDefinitelyNotNullableViaIntersection() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("approximation.kt")
|
||||||
|
public void testApproximation() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/approximation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("bareTypes.kt")
|
||||||
|
public void testBareTypes() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/bareTypes.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("disabledFeature.kt")
|
||||||
|
public void testDisabledFeature() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inference.kt")
|
||||||
|
public void testInference() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/inference.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("isAsOperators.kt")
|
||||||
|
public void testIsAsOperators() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/isAsOperators.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("isAsOperatorsEnabled.kt")
|
||||||
|
public void testIsAsOperatorsEnabled() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/isAsOperatorsEnabled.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("notApplicable.kt")
|
||||||
|
public void testNotApplicable() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/notApplicable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overrides.kt")
|
||||||
|
public void testOverrides() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/overrides.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overridesJavaAnnotated.kt")
|
||||||
|
public void testOverridesJavaAnnotated() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/overridesJavaAnnotated.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("simple.kt")
|
||||||
|
public void testSimple() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/simple.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+70
@@ -10116,6 +10116,76 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class ExplicitDefinitelyNotNullableViaIntersection {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInExplicitDefinitelyNotNullableViaIntersection() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("approximation.kt")
|
||||||
|
public void testApproximation() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/approximation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("bareTypes.kt")
|
||||||
|
public void testBareTypes() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/bareTypes.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("disabledFeature.kt")
|
||||||
|
public void testDisabledFeature() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inference.kt")
|
||||||
|
public void testInference() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/inference.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("isAsOperators.kt")
|
||||||
|
public void testIsAsOperators() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/isAsOperators.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("isAsOperatorsEnabled.kt")
|
||||||
|
public void testIsAsOperatorsEnabled() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/isAsOperatorsEnabled.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("notApplicable.kt")
|
||||||
|
public void testNotApplicable() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/notApplicable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overrides.kt")
|
||||||
|
public void testOverrides() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/overrides.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overridesJavaAnnotated.kt")
|
||||||
|
public void testOverridesJavaAnnotated() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/overridesJavaAnnotated.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("simple.kt")
|
||||||
|
public void testSimple() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/simple.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+10
-2
@@ -1810,6 +1810,11 @@ class DeclarationsConverter(
|
|||||||
source = typeRefSource
|
source = typeRefSource
|
||||||
isMarkedNullable = false
|
isMarkedNullable = false
|
||||||
}
|
}
|
||||||
|
INTERSECTION_TYPE -> firType =
|
||||||
|
buildErrorTypeRef {
|
||||||
|
source = typeRefSource
|
||||||
|
diagnostic = ConeSimpleDiagnostic("Intersection types are not supported yet", DiagnosticKind.Syntax)
|
||||||
|
}
|
||||||
TokenType.ERROR_ELEMENT -> firType =
|
TokenType.ERROR_ELEMENT -> firType =
|
||||||
buildErrorTypeRef {
|
buildErrorTypeRef {
|
||||||
source = typeRefSource
|
source = typeRefSource
|
||||||
@@ -1861,12 +1866,15 @@ class DeclarationsConverter(
|
|||||||
USER_TYPE -> firType = convertUserType(typeRefSource, it, isNullable)
|
USER_TYPE -> firType = convertUserType(typeRefSource, it, isNullable)
|
||||||
FUNCTION_TYPE -> firType = convertFunctionType(typeRefSource, it, isNullable, isSuspend = allTypeModifiers.hasSuspend())
|
FUNCTION_TYPE -> firType = convertFunctionType(typeRefSource, it, isNullable, isSuspend = allTypeModifiers.hasSuspend())
|
||||||
NULLABLE_TYPE -> firType = convertNullableType(typeRefSource, it, allTypeModifiers)
|
NULLABLE_TYPE -> firType = convertNullableType(typeRefSource, it, allTypeModifiers)
|
||||||
DEFINITELY_NOT_NULL_TYPE -> firType =
|
|
||||||
unwrapDefinitelyNotNullableType(typeRefSource, it, allTypeModifiers, isNullable = true)
|
|
||||||
DYNAMIC_TYPE -> firType = buildDynamicTypeRef {
|
DYNAMIC_TYPE -> firType = buildDynamicTypeRef {
|
||||||
source = typeRefSource
|
source = typeRefSource
|
||||||
isMarkedNullable = true
|
isMarkedNullable = true
|
||||||
}
|
}
|
||||||
|
INTERSECTION_TYPE -> firType =
|
||||||
|
buildErrorTypeRef {
|
||||||
|
source = typeRefSource
|
||||||
|
diagnostic = ConeSimpleDiagnostic("Intersection types are not supported yet", DiagnosticKind.Syntax)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1605,6 +1605,10 @@ open class RawFirBuilder(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
is KtIntersectionType -> FirErrorTypeRefBuilder().apply {
|
||||||
|
this.source = source
|
||||||
|
diagnostic = ConeSimpleDiagnostic("Intersection types are not supported yet", DiagnosticKind.Syntax)
|
||||||
|
}
|
||||||
null -> FirErrorTypeRefBuilder().apply {
|
null -> FirErrorTypeRefBuilder().apply {
|
||||||
this.source = source
|
this.source = source
|
||||||
diagnostic = ConeSimpleDiagnostic("Unwrapped type is null", DiagnosticKind.Syntax)
|
diagnostic = ConeSimpleDiagnostic("Unwrapped type is null", DiagnosticKind.Syntax)
|
||||||
|
|||||||
@@ -161,6 +161,8 @@ public interface Errors {
|
|||||||
DiagnosticFactory0<KtNullableType> REDUNDANT_NULLABLE = DiagnosticFactory0.create(WARNING, NULLABLE_TYPE);
|
DiagnosticFactory0<KtNullableType> REDUNDANT_NULLABLE = DiagnosticFactory0.create(WARNING, NULLABLE_TYPE);
|
||||||
DiagnosticFactory0<KtDefinitelyNotNullType> DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<KtDefinitelyNotNullType> DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE = DiagnosticFactory0.create(ERROR);
|
||||||
DiagnosticFactory0<KtNullableType> NULLABLE_ON_DEFINITELY_NOT_NULLABLE = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<KtNullableType> NULLABLE_ON_DEFINITELY_NOT_NULLABLE = DiagnosticFactory0.create(ERROR);
|
||||||
|
DiagnosticFactory0<KtTypeReference> INCORRECT_LEFT_COMPONENT_OF_INTERSECTION = DiagnosticFactory0.create(ERROR);
|
||||||
|
DiagnosticFactory0<KtTypeReference> INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION = DiagnosticFactory0.create(ERROR);
|
||||||
DiagnosticFactory2<KtElement, Integer, DeclarationDescriptor> WRONG_NUMBER_OF_TYPE_ARGUMENTS = DiagnosticFactory2.create(ERROR);
|
DiagnosticFactory2<KtElement, Integer, DeclarationDescriptor> WRONG_NUMBER_OF_TYPE_ARGUMENTS = DiagnosticFactory2.create(ERROR);
|
||||||
DiagnosticFactory1<KtElement, ClassDescriptor> OUTER_CLASS_ARGUMENTS_REQUIRED = DiagnosticFactory1.create(ERROR);
|
DiagnosticFactory1<KtElement, ClassDescriptor> OUTER_CLASS_ARGUMENTS_REQUIRED = DiagnosticFactory1.create(ERROR);
|
||||||
DiagnosticFactory1<KtElement, String> TYPE_ARGUMENTS_NOT_ALLOWED = DiagnosticFactory1.create(ERROR);
|
DiagnosticFactory1<KtElement, String> TYPE_ARGUMENTS_NOT_ALLOWED = DiagnosticFactory1.create(ERROR);
|
||||||
|
|||||||
+2
@@ -696,6 +696,8 @@ public class DefaultErrorMessages {
|
|||||||
MAP.put(REDUNDANT_NULLABLE, "Redundant '?'");
|
MAP.put(REDUNDANT_NULLABLE, "Redundant '?'");
|
||||||
MAP.put(DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE, "'!!' is only applicable to type parameters with nullable upper bounds");
|
MAP.put(DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE, "'!!' is only applicable to type parameters with nullable upper bounds");
|
||||||
MAP.put(NULLABLE_ON_DEFINITELY_NOT_NULLABLE, "'!!' type cannot be marked as nullable");
|
MAP.put(NULLABLE_ON_DEFINITELY_NOT_NULLABLE, "'!!' type cannot be marked as nullable");
|
||||||
|
MAP.put(INCORRECT_LEFT_COMPONENT_OF_INTERSECTION, "Intersection types are only supported for definitely non-nullable types: left part should be a type parameter with nullable bounds");
|
||||||
|
MAP.put(INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION, "Intersection types are only supported for definitely non-nullable types: right part should be non-nullable Any");
|
||||||
MAP.put(UNSAFE_CALL, "Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type {0}", RENDER_TYPE);
|
MAP.put(UNSAFE_CALL, "Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type {0}", RENDER_TYPE);
|
||||||
MAP.put(UNSAFE_IMPLICIT_INVOKE_CALL, "Reference has a nullable type ''{0}'', use explicit ''?.invoke()'' to make a function-like call instead", RENDER_TYPE);
|
MAP.put(UNSAFE_IMPLICIT_INVOKE_CALL, "Reference has a nullable type ''{0}'', use explicit ''?.invoke()'' to make a function-like call instead", RENDER_TYPE);
|
||||||
MAP.put(AMBIGUOUS_LABEL, "Ambiguous label");
|
MAP.put(AMBIGUOUS_LABEL, "Ambiguous label");
|
||||||
|
|||||||
@@ -55,9 +55,7 @@ import org.jetbrains.kotlin.resolve.source.getPsi
|
|||||||
import org.jetbrains.kotlin.resolve.source.toSourceElement
|
import org.jetbrains.kotlin.resolve.source.toSourceElement
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import org.jetbrains.kotlin.types.Variance.*
|
import org.jetbrains.kotlin.types.Variance.*
|
||||||
import org.jetbrains.kotlin.types.typeUtil.containsTypeAliasParameters
|
import org.jetbrains.kotlin.types.typeUtil.*
|
||||||
import org.jetbrains.kotlin.types.typeUtil.containsTypeAliases
|
|
||||||
import org.jetbrains.kotlin.types.typeUtil.isArrayOfNothing
|
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
@@ -319,6 +317,57 @@ class TypeResolver(
|
|||||||
result = type(definitelyNotNullKotlinType)
|
result = type(definitelyNotNullKotlinType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun visitIntersectionType(intersectionType: KtIntersectionType) {
|
||||||
|
val leftType = resolvePossiblyBareType(c, intersectionType.getLeftTypeRef() ?: return).let {
|
||||||
|
when {
|
||||||
|
it.isBare -> error("There should not be bare types for intersections")
|
||||||
|
else -> it.actualType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Just in case of early return
|
||||||
|
result = type(leftType)
|
||||||
|
|
||||||
|
val rightType = resolvePossiblyBareType(c, intersectionType.getRightTypeRef() ?: return).let {
|
||||||
|
when {
|
||||||
|
it.isBare -> error("There should not be bare types for intersections")
|
||||||
|
else -> it.actualType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!languageVersionSettings.supportsFeature(LanguageFeature.DefinitelyNotNullTypeParameters)) {
|
||||||
|
c.trace.report(
|
||||||
|
UNSUPPORTED_FEATURE.on(
|
||||||
|
intersectionType,
|
||||||
|
LanguageFeature.DefinitelyNotNullTypeParameters to languageVersionSettings
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!leftType.isTypeParameter() || leftType.isMarkedNullable || !TypeUtils.isNullableType(leftType)) {
|
||||||
|
c.trace.report(INCORRECT_LEFT_COMPONENT_OF_INTERSECTION.on(intersectionType.getLeftTypeRef()!!))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rightType.isAny()) {
|
||||||
|
c.trace.report(INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION.on(intersectionType.getRightTypeRef()!!))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val definitelyNotNullType =
|
||||||
|
DefinitelyNotNullType.makeDefinitelyNotNull(leftType.unwrap())
|
||||||
|
?: error(
|
||||||
|
"Definitely not-nullable type is not created for type parameter with nullable upper bound ${
|
||||||
|
TypeUtils.getTypeParameterDescriptorOrNull(
|
||||||
|
leftType
|
||||||
|
)!!
|
||||||
|
}"
|
||||||
|
)
|
||||||
|
|
||||||
|
result = type(definitelyNotNullType)
|
||||||
|
}
|
||||||
|
|
||||||
override fun visitFunctionType(type: KtFunctionType) {
|
override fun visitFunctionType(type: KtFunctionType) {
|
||||||
val receiverTypeRef = type.receiverTypeReference
|
val receiverTypeRef = type.receiverTypeReference
|
||||||
val receiverType = if (receiverTypeRef == null) null else resolveType(c.noBareTypes(), receiverTypeRef)
|
val receiverType = if (receiverTypeRef == null) null else resolveType(c.noBareTypes(), receiverTypeRef)
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ public interface KtNodeTypes {
|
|||||||
IElementType FUNCTION_TYPE_RECEIVER = KtStubElementTypes.FUNCTION_TYPE_RECEIVER;
|
IElementType FUNCTION_TYPE_RECEIVER = KtStubElementTypes.FUNCTION_TYPE_RECEIVER;
|
||||||
IElementType NULLABLE_TYPE = KtStubElementTypes.NULLABLE_TYPE;
|
IElementType NULLABLE_TYPE = KtStubElementTypes.NULLABLE_TYPE;
|
||||||
IElementType DEFINITELY_NOT_NULL_TYPE = KtStubElementTypes.DEFINITELY_NOT_NULL_TYPE;
|
IElementType DEFINITELY_NOT_NULL_TYPE = KtStubElementTypes.DEFINITELY_NOT_NULL_TYPE;
|
||||||
|
IElementType INTERSECTION_TYPE = KtStubElementTypes.INTERSECTION_TYPE;
|
||||||
IElementType TYPE_PROJECTION = KtStubElementTypes.TYPE_PROJECTION;
|
IElementType TYPE_PROJECTION = KtStubElementTypes.TYPE_PROJECTION;
|
||||||
|
|
||||||
IElementType PROPERTY_ACCESSOR = KtStubElementTypes.PROPERTY_ACCESSOR;
|
IElementType PROPERTY_ACCESSOR = KtStubElementTypes.PROPERTY_ACCESSOR;
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
|||||||
AS(AS_KEYWORD, AS_SAFE) {
|
AS(AS_KEYWORD, AS_SAFE) {
|
||||||
@Override
|
@Override
|
||||||
public IElementType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
|
public IElementType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
|
||||||
parser.myKotlinParsing.parseTypeRefWithoutDefinitelyNotNull();
|
parser.myKotlinParsing.parseTypeRefWithoutIntersections();
|
||||||
return BINARY_WITH_TYPE;
|
return BINARY_WITH_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
|||||||
@Override
|
@Override
|
||||||
public IElementType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
|
public IElementType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
|
||||||
if (operation == IS_KEYWORD || operation == NOT_IS) {
|
if (operation == IS_KEYWORD || operation == NOT_IS) {
|
||||||
parser.myKotlinParsing.parseTypeRefWithoutDefinitelyNotNull();
|
parser.myKotlinParsing.parseTypeRefWithoutIntersections();
|
||||||
return IS_EXPRESSION;
|
return IS_EXPRESSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -833,7 +833,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
|||||||
|
|
||||||
PsiBuilder.Marker reference = mark();
|
PsiBuilder.Marker reference = mark();
|
||||||
PsiBuilder.Marker typeReference = mark();
|
PsiBuilder.Marker typeReference = mark();
|
||||||
parseUserType(/* allowNotNullTypeParameter */ false);
|
parseUserType(/* allowSimpleIntersectionTypes */ false);
|
||||||
typeReference.done(TYPE_REFERENCE);
|
typeReference.done(TYPE_REFERENCE);
|
||||||
reference.done(CONSTRUCTOR_CALLEE);
|
reference.done(CONSTRUCTOR_CALLEE);
|
||||||
|
|
||||||
@@ -1713,7 +1713,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
|||||||
|
|
||||||
if (!receiverPresent) return false;
|
if (!receiverPresent) return false;
|
||||||
|
|
||||||
createTruncatedBuilder(lastDot).parseTypeRef();
|
createTruncatedBuilder(lastDot).parseTypeRefWithoutIntersections();
|
||||||
|
|
||||||
if (atSet(RECEIVER_TYPE_TERMINATORS)) {
|
if (atSet(RECEIVER_TYPE_TERMINATORS)) {
|
||||||
advance(); // expectation
|
advance(); // expectation
|
||||||
@@ -2055,22 +2055,22 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
|||||||
parseTypeRef(TokenSet.EMPTY);
|
parseTypeRef(TokenSet.EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseTypeRefWithoutDefinitelyNotNull() {
|
void parseTypeRefWithoutIntersections() {
|
||||||
parseTypeRef(TokenSet.EMPTY, /* allowNotNullTypeParameters */ false);
|
parseTypeRef(TokenSet.EMPTY, /* allowSimpleIntersectionTypes */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseTypeRef(TokenSet extraRecoverySet) {
|
void parseTypeRef(TokenSet extraRecoverySet) {
|
||||||
parseTypeRef(extraRecoverySet, /* allowNotNullTypeParameters */ true);
|
parseTypeRef(extraRecoverySet, /* allowSimpleIntersectionTypes */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseTypeRef(TokenSet extraRecoverySet, boolean allowNotNullTypeParameters) {
|
private void parseTypeRef(TokenSet extraRecoverySet, boolean allowSimpleIntersectionTypes) {
|
||||||
PsiBuilder.Marker typeRefMarker = parseTypeRefContents(extraRecoverySet, allowNotNullTypeParameters);
|
PsiBuilder.Marker typeRefMarker = parseTypeRefContents(extraRecoverySet, allowSimpleIntersectionTypes);
|
||||||
typeRefMarker.done(TYPE_REFERENCE);
|
typeRefMarker.done(TYPE_REFERENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The extraRecoverySet is needed for the foo(bar<x, 1, y>(z)) case, to tell whether we should stop
|
// The extraRecoverySet is needed for the foo(bar<x, 1, y>(z)) case, to tell whether we should stop
|
||||||
// on expression-indicating symbols or not
|
// on expression-indicating symbols or not
|
||||||
private PsiBuilder.Marker parseTypeRefContents(TokenSet extraRecoverySet, boolean allowNotNullTypeParameters) {
|
private PsiBuilder.Marker parseTypeRefContents(TokenSet extraRecoverySet, boolean allowSimpleIntersectionTypes) {
|
||||||
PsiBuilder.Marker typeRefMarker = mark();
|
PsiBuilder.Marker typeRefMarker = mark();
|
||||||
|
|
||||||
parseTypeModifierList();
|
parseTypeModifierList();
|
||||||
@@ -2086,14 +2086,14 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
|||||||
dynamicType.done(DYNAMIC_TYPE);
|
dynamicType.done(DYNAMIC_TYPE);
|
||||||
}
|
}
|
||||||
else if (at(IDENTIFIER) || at(PACKAGE_KEYWORD) || atParenthesizedMutableForPlatformTypes(0)) {
|
else if (at(IDENTIFIER) || at(PACKAGE_KEYWORD) || atParenthesizedMutableForPlatformTypes(0)) {
|
||||||
parseUserType(allowNotNullTypeParameters);
|
parseUserType(allowSimpleIntersectionTypes);
|
||||||
}
|
}
|
||||||
else if (at(LPAR)) {
|
else if (at(LPAR)) {
|
||||||
PsiBuilder.Marker functionOrParenthesizedType = mark();
|
PsiBuilder.Marker functionOrParenthesizedType = mark();
|
||||||
|
|
||||||
// This may be a function parameter list or just a parenthesized type
|
// This may be a function parameter list or just a parenthesized type
|
||||||
advance(); // LPAR
|
advance(); // LPAR
|
||||||
parseTypeRefContents(TokenSet.EMPTY, allowNotNullTypeParameters).drop(); // parenthesized types, no reference element around it is needed
|
parseTypeRefContents(TokenSet.EMPTY, /* allowSimpleIntersectionTypes */ true).drop(); // parenthesized types, no reference element around it is needed
|
||||||
|
|
||||||
if (at(RPAR)) {
|
if (at(RPAR)) {
|
||||||
advance(); // RPAR
|
advance(); // RPAR
|
||||||
@@ -2133,7 +2133,23 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
|||||||
typeElementMarker = parseNullableTypeSuffix(typeElementMarker);
|
typeElementMarker = parseNullableTypeSuffix(typeElementMarker);
|
||||||
myBuilder.restoreJoiningComplexTokensState();
|
myBuilder.restoreJoiningComplexTokensState();
|
||||||
|
|
||||||
if (typeBeforeDot && at(DOT)) {
|
boolean wasIntersection = false;
|
||||||
|
if (allowSimpleIntersectionTypes && at(AND)) {
|
||||||
|
PsiBuilder.Marker leftTypeRef = typeElementMarker;
|
||||||
|
|
||||||
|
typeElementMarker = typeElementMarker.precede();
|
||||||
|
PsiBuilder.Marker intersectionType = leftTypeRef.precede();
|
||||||
|
|
||||||
|
leftTypeRef.done(TYPE_REFERENCE);
|
||||||
|
|
||||||
|
advance(); // &
|
||||||
|
parseTypeRef(extraRecoverySet, /* allowSimpleIntersectionTypes */ true);
|
||||||
|
|
||||||
|
intersectionType.done(INTERSECTION_TYPE);
|
||||||
|
wasIntersection = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeBeforeDot && !wasIntersection && at(DOT)) {
|
||||||
// This is a receiver for a function type
|
// This is a receiver for a function type
|
||||||
// A.(B) -> C
|
// A.(B) -> C
|
||||||
// ^
|
// ^
|
||||||
@@ -2183,7 +2199,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
|||||||
* - (Mutable)List<Foo>!
|
* - (Mutable)List<Foo>!
|
||||||
* - Array<(out) Foo>!
|
* - Array<(out) Foo>!
|
||||||
*/
|
*/
|
||||||
private void parseUserType(boolean allowNotNullTypeParameter) {
|
private void parseUserType(boolean allowSimpleIntersectionTypes) {
|
||||||
PsiBuilder.Marker userType = mark();
|
PsiBuilder.Marker userType = mark();
|
||||||
|
|
||||||
if (at(PACKAGE_KEYWORD)) {
|
if (at(PACKAGE_KEYWORD)) {
|
||||||
@@ -2228,12 +2244,6 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userType.done(USER_TYPE);
|
userType.done(USER_TYPE);
|
||||||
|
|
||||||
if (allowNotNullTypeParameter && at(EXCLEXCL)) {
|
|
||||||
PsiBuilder.Marker definitelyNotNull = userType.precede();
|
|
||||||
advance(); // !!
|
|
||||||
definitelyNotNull.done(DEFINITELY_NOT_NULL_TYPE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean atParenthesizedMutableForPlatformTypes(int offset) {
|
private boolean atParenthesizedMutableForPlatformTypes(int offset) {
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.psi
|
||||||
|
|
||||||
|
import com.intellij.lang.ASTNode
|
||||||
|
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub
|
||||||
|
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
|
||||||
|
|
||||||
|
class KtIntersectionType : KtElementImplStub<KotlinPlaceHolderStub<KtIntersectionType>>, KtTypeElement {
|
||||||
|
constructor(node: ASTNode) : super(node)
|
||||||
|
constructor(stub: KotlinPlaceHolderStub<KtIntersectionType>) : super(stub, KtStubElementTypes.INTERSECTION_TYPE)
|
||||||
|
|
||||||
|
override fun getTypeArgumentsAsTypes(): List<KtTypeReference> = emptyList()
|
||||||
|
|
||||||
|
fun getLeftTypeRef(): KtTypeReference? = getStubOrPsiChildrenAsList(KtStubElementTypes.TYPE_REFERENCE).getOrNull(0)
|
||||||
|
fun getRightTypeRef(): KtTypeReference? = getStubOrPsiChildrenAsList(KtStubElementTypes.TYPE_REFERENCE).getOrNull(1)
|
||||||
|
|
||||||
|
override fun <R, D> accept(visitor: KtVisitor<R, D>, data: D): R {
|
||||||
|
return visitor.visitIntersectionType(this, data)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -406,6 +406,10 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
|
|||||||
return visitTypeElement(definitelyNotNullType, data);
|
return visitTypeElement(definitelyNotNullType, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public R visitIntersectionType(@NotNull KtIntersectionType definitelyNotNullType, D data) {
|
||||||
|
return visitTypeElement(definitelyNotNullType, data);
|
||||||
|
}
|
||||||
|
|
||||||
public R visitTypeProjection(@NotNull KtTypeProjection typeProjection, D data) {
|
public R visitTypeProjection(@NotNull KtTypeProjection typeProjection, D data) {
|
||||||
return visitKtElement(typeProjection, data);
|
return visitKtElement(typeProjection, data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -389,6 +389,10 @@ public class KtVisitorVoid extends KtVisitor<Void, Void> {
|
|||||||
super.visitDefinitelyNotNullType(definitelyNotNullType, null);
|
super.visitDefinitelyNotNullType(definitelyNotNullType, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void visitIntersectionType(@NotNull KtIntersectionType intersectionType) {
|
||||||
|
super.visitIntersectionType(intersectionType, null);
|
||||||
|
}
|
||||||
|
|
||||||
public void visitTypeProjection(@NotNull KtTypeProjection typeProjection) {
|
public void visitTypeProjection(@NotNull KtTypeProjection typeProjection) {
|
||||||
super.visitTypeProjection(typeProjection, null);
|
super.visitTypeProjection(typeProjection, null);
|
||||||
}
|
}
|
||||||
@@ -982,6 +986,12 @@ public class KtVisitorVoid extends KtVisitor<Void, Void> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Void visitIntersectionType(@NotNull KtIntersectionType intersectionType, Void data) {
|
||||||
|
visitIntersectionType(intersectionType);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Void visitTypeProjection(@NotNull KtTypeProjection typeProjection, Void data) {
|
public final Void visitTypeProjection(@NotNull KtTypeProjection typeProjection, Void data) {
|
||||||
visitTypeProjection(typeProjection);
|
visitTypeProjection(typeProjection);
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ public interface KtStubElementTypes {
|
|||||||
KtPlaceHolderStubElementType<KtDefinitelyNotNullType> DEFINITELY_NOT_NULL_TYPE =
|
KtPlaceHolderStubElementType<KtDefinitelyNotNullType> DEFINITELY_NOT_NULL_TYPE =
|
||||||
new KtPlaceHolderStubElementType<>("DEFINITELY_NOT_NULL_TYPE", KtDefinitelyNotNullType.class);
|
new KtPlaceHolderStubElementType<>("DEFINITELY_NOT_NULL_TYPE", KtDefinitelyNotNullType.class);
|
||||||
|
|
||||||
|
KtPlaceHolderStubElementType<KtIntersectionType> INTERSECTION_TYPE =
|
||||||
|
new KtPlaceHolderStubElementType<>("INTERSECTION_TYPE", KtIntersectionType.class);
|
||||||
|
|
||||||
KtPlaceHolderStubElementType<KtTypeReference> TYPE_REFERENCE =
|
KtPlaceHolderStubElementType<KtTypeReference> TYPE_REFERENCE =
|
||||||
new KtPlaceHolderStubElementType<>("TYPE_REFERENCE", KtTypeReference.class);
|
new KtPlaceHolderStubElementType<>("TYPE_REFERENCE", KtTypeReference.class);
|
||||||
|
|
||||||
@@ -170,7 +173,7 @@ public interface KtStubElementTypes {
|
|||||||
|
|
||||||
TokenSet SUPER_TYPE_LIST_ENTRIES = TokenSet.create(DELEGATED_SUPER_TYPE_ENTRY, SUPER_TYPE_CALL_ENTRY, SUPER_TYPE_ENTRY);
|
TokenSet SUPER_TYPE_LIST_ENTRIES = TokenSet.create(DELEGATED_SUPER_TYPE_ENTRY, SUPER_TYPE_CALL_ENTRY, SUPER_TYPE_ENTRY);
|
||||||
|
|
||||||
TokenSet TYPE_ELEMENT_TYPES = TokenSet.create(USER_TYPE, NULLABLE_TYPE, FUNCTION_TYPE, DYNAMIC_TYPE, DEFINITELY_NOT_NULL_TYPE);
|
TokenSet TYPE_ELEMENT_TYPES = TokenSet.create(USER_TYPE, NULLABLE_TYPE, FUNCTION_TYPE, DYNAMIC_TYPE, INTERSECTION_TYPE);
|
||||||
|
|
||||||
TokenSet INSIDE_DIRECTIVE_EXPRESSIONS = TokenSet.create(REFERENCE_EXPRESSION, DOT_QUALIFIED_EXPRESSION);
|
TokenSet INSIDE_DIRECTIVE_EXPRESSIONS = TokenSet.create(REFERENCE_EXPRESSION, DOT_QUALIFIED_EXPRESSION);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public abstract class JClass<T> {
|
|||||||
|
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
class KDerived<E> : JClass<E>() {
|
class KDerived<E> : JClass<E>() {
|
||||||
override fun foo(e: E!!) {
|
override fun foo(e: E & Any) {
|
||||||
throw RuntimeException("Should not be called")
|
throw RuntimeException("Should not be called")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun <T> foo(x: T, y: T & Any) = x!!
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
foo<String>("", "").length
|
||||||
|
foo<String>("", null).length
|
||||||
|
foo<String?>(null, "").length
|
||||||
|
foo<String?>(null, null).length
|
||||||
|
|
||||||
|
foo("", "").length
|
||||||
|
foo("", null).length
|
||||||
|
foo(null, "").<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
}
|
||||||
Vendored
+14
@@ -0,0 +1,14 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun <T> foo(x: T, y: T & Any) = x!!
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
foo<String>("", "").length
|
||||||
|
foo<String>("", <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||||
|
foo<String?>(null, "").length
|
||||||
|
foo<String?>(null, <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||||
|
|
||||||
|
foo("", "").length
|
||||||
|
foo("", <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||||
|
foo(null, "").length
|
||||||
|
}
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun </*0*/ T> foo(/*0*/ x: T, /*1*/ y: T!!): T!!
|
||||||
|
public fun main(): kotlin.Unit
|
||||||
|
|
||||||
Vendored
+7
@@ -0,0 +1,7 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun main(x: Collection<String>) {
|
||||||
|
if (x is List<!SYNTAX!><!> <!SYNTAX!><!SYNTAX!><!>& Any)<!> {}
|
||||||
|
|
||||||
|
val w: List & Any = null!!
|
||||||
|
}
|
||||||
Vendored
+7
@@ -0,0 +1,7 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun main(x: Collection<String>) {
|
||||||
|
if (x is List<!SYNTAX!><!> <!SYNTAX!><!SYNTAX!><!>& Any)<!> {}
|
||||||
|
|
||||||
|
val w: <!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION, WRONG_NUMBER_OF_TYPE_ARGUMENTS!>List<!> & Any = null!!
|
||||||
|
}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun main(/*0*/ x: kotlin.collections.Collection<kotlin.String>): kotlin.Unit
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
// !LANGUAGE: -DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun <T> foo(x: T, y: T & Any): List<T & Any>? = null
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
// !LANGUAGE: -DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun <T> foo(x: T, y: <!UNSUPPORTED_FEATURE!>T & Any<!>): List<<!UNSUPPORTED_FEATURE!>T & Any<!>>? = null
|
||||||
compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.txt
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun </*0*/ T> foo(/*0*/ x: T, /*1*/ y: T): kotlin.collections.List<T>?
|
||||||
Vendored
+33
@@ -0,0 +1,33 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun <T> toDefNotNull(s: T): T & Any = s!!
|
||||||
|
|
||||||
|
fun <K> removeQuestionMark(x: K?): K = x!!
|
||||||
|
|
||||||
|
fun Any.foo() {}
|
||||||
|
|
||||||
|
fun <E> expectNN(e: E & Any) {}
|
||||||
|
|
||||||
|
fun <F> main(x: F, y: F, z: F, w: F, m: F) {
|
||||||
|
val y1 = toDefNotNull(x) // K instead of K & Any
|
||||||
|
val y2: F & Any = toDefNotNull(x) // K instead of K & Any
|
||||||
|
val x1 = removeQuestionMark(x) // T or T & Any
|
||||||
|
val x2: F & Any = removeQuestionMark(x) // T or T & Any
|
||||||
|
|
||||||
|
val z1 = x!!
|
||||||
|
val z2: F & Any = y!!
|
||||||
|
val w1 = if (z != null) z else return
|
||||||
|
val w2: F & Any = if (w != null) w else return
|
||||||
|
|
||||||
|
y1.foo()
|
||||||
|
y2.foo()
|
||||||
|
x1.foo()
|
||||||
|
x2.foo()
|
||||||
|
z1.foo()
|
||||||
|
z2.foo()
|
||||||
|
w1.foo()
|
||||||
|
w2.foo()
|
||||||
|
|
||||||
|
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>expectNN<!>(m)
|
||||||
|
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>expectNN<!>(m!!)
|
||||||
|
}
|
||||||
Vendored
+33
@@ -0,0 +1,33 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun <T> toDefNotNull(s: T): T & Any = s!!
|
||||||
|
|
||||||
|
fun <K> removeQuestionMark(x: K?): K = x!!
|
||||||
|
|
||||||
|
fun Any.foo() {}
|
||||||
|
|
||||||
|
fun <E> expectNN(e: E & Any) {}
|
||||||
|
|
||||||
|
fun <F> main(x: F, y: F, z: F, w: F, m: F) {
|
||||||
|
val y1 = toDefNotNull(x) // K instead of K & Any
|
||||||
|
val y2: F & Any = toDefNotNull(x) // K instead of K & Any
|
||||||
|
val x1 = removeQuestionMark(x) // T or T & Any
|
||||||
|
val x2: F & Any = removeQuestionMark(x) // T or T & Any
|
||||||
|
|
||||||
|
val z1 = x!!
|
||||||
|
val z2: F & Any = y!!
|
||||||
|
val w1 = if (z != null) <!DEBUG_INFO_SMARTCAST!>z<!> else return
|
||||||
|
val w2: F & Any = if (w != null) <!DEBUG_INFO_SMARTCAST!>w<!> else return
|
||||||
|
|
||||||
|
y1.foo()
|
||||||
|
y2.foo()
|
||||||
|
x1.foo()
|
||||||
|
x2.foo()
|
||||||
|
z1.foo()
|
||||||
|
z2.foo()
|
||||||
|
w1.foo()
|
||||||
|
w2.foo()
|
||||||
|
|
||||||
|
expectNN(<!TYPE_MISMATCH!>m<!>)
|
||||||
|
expectNN(m!!)
|
||||||
|
}
|
||||||
Vendored
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun </*0*/ E> expectNN(/*0*/ e: E!!): kotlin.Unit
|
||||||
|
public fun </*0*/ F> main(/*0*/ x: F, /*1*/ y: F, /*2*/ z: F, /*3*/ w: F, /*4*/ m: F): kotlin.Unit
|
||||||
|
public fun </*0*/ K> removeQuestionMark(/*0*/ x: K?): K
|
||||||
|
public fun </*0*/ T> toDefNotNull(/*0*/ s: T): T!!
|
||||||
|
public fun kotlin.Any.foo(): kotlin.Unit
|
||||||
Vendored
+17
@@ -0,0 +1,17 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// SKIP_TXT
|
||||||
|
// !LANGUAGE: -DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun Any.bar() {}
|
||||||
|
fun Boolean.baz() {}
|
||||||
|
|
||||||
|
var x: Int = 0
|
||||||
|
|
||||||
|
inline fun <reified T> foo(v: Any?): T {
|
||||||
|
if (x > 0) 1 else v as T <!SYNTAX!>& Any<!>
|
||||||
|
if (x > 1) 2 else v as? T <!SYNTAX!>& Any<!>
|
||||||
|
if (x > 2) 3 else v is T <!SYNTAX!>& Any<!>
|
||||||
|
if (x > 3) 4 else v !is T <!SYNTAX!>& Any<!>
|
||||||
|
|
||||||
|
return v as T <!SYNTAX!>& Any<!>
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// SKIP_TXT
|
||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun Any.bar() {}
|
||||||
|
fun Boolean.baz() {}
|
||||||
|
|
||||||
|
var x: Int = 0
|
||||||
|
|
||||||
|
inline fun <reified T> foo(v: Any?): T {
|
||||||
|
if (x > 0) 1 else v as T <!SYNTAX!>& Any<!>
|
||||||
|
if (x > 1) 2 else v as? T <!SYNTAX!>& Any<!>
|
||||||
|
if (x > 2) 3 else v is T <!SYNTAX!>& Any<!>
|
||||||
|
if (x > 3) 4 else v !is T <!SYNTAX!>& Any<!>
|
||||||
|
|
||||||
|
return v as T <!SYNTAX!>& Any<!>
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun <T : Any> foo(x: T & Any, y: List<String & Any> & Any) {}
|
||||||
|
|
||||||
|
fun <F> bar1(x: F? & Any) {}
|
||||||
|
fun <F> bar2(x: F & Any?) {}
|
||||||
|
fun <F> bar3(x: (F?) & Any) {}
|
||||||
|
fun <F> bar4(x: (F & Any)?) {}
|
||||||
|
|
||||||
|
fun <F> bar5(x: F & String) {}
|
||||||
|
|
||||||
|
fun <F> bar6(x: F & (F & Any)) {}
|
||||||
|
fun <F> bar7(x: (F & Any) & Any) {}
|
||||||
|
fun <F> bar8(x: (F & Any).() -> Unit) {}
|
||||||
|
fun <F> (F & Any).bar9(x: () -> Unit) {}
|
||||||
|
|
||||||
|
fun <F> bar10(x: F & Any & String) {}
|
||||||
|
fun <F> bar11(x: Double & Any & String) {}
|
||||||
Vendored
+18
@@ -0,0 +1,18 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun <T : Any> foo(x: <!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>T<!> & Any, y: <!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>List<<!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>String<!> & Any><!> & Any) {}
|
||||||
|
|
||||||
|
fun <F> bar1(x: <!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>F?<!> & Any) {}
|
||||||
|
fun <F> bar2(x: F & <!INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION!>Any?<!>) {}
|
||||||
|
fun <F> bar3(x: <!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>(F?)<!> & Any) {}
|
||||||
|
fun <F> bar4(x: <!NULLABLE_ON_DEFINITELY_NOT_NULLABLE!>(F & Any)?<!>) {}
|
||||||
|
|
||||||
|
fun <F> bar5(x: F & <!INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION!>String<!>) {}
|
||||||
|
|
||||||
|
fun <F> bar6(x: F & <!INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION!>(F & Any)<!>) {}
|
||||||
|
fun <F> bar7(x: <!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>(F & Any)<!> & Any) {}
|
||||||
|
fun <F> bar8(x: (F & Any).() -> Unit) {}
|
||||||
|
fun <F> (F & Any).bar9(x: () -> Unit) {}
|
||||||
|
|
||||||
|
fun <F> bar10(x: F & <!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>Any<!> & String) {}
|
||||||
|
fun <F> bar11(x: <!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>Double<!> & <!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>Any<!> & String) {}
|
||||||
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun </*0*/ F> bar1(/*0*/ x: F?): kotlin.Unit
|
||||||
|
public fun </*0*/ F> bar10(/*0*/ x: F & Any): kotlin.Unit
|
||||||
|
public fun </*0*/ F> bar11(/*0*/ x: kotlin.Double): kotlin.Unit
|
||||||
|
public fun </*0*/ F> bar2(/*0*/ x: F): kotlin.Unit
|
||||||
|
public fun </*0*/ F> bar3(/*0*/ x: F?): kotlin.Unit
|
||||||
|
public fun </*0*/ F> bar4(/*0*/ x: F?): kotlin.Unit
|
||||||
|
public fun </*0*/ F> bar5(/*0*/ x: F): kotlin.Unit
|
||||||
|
public fun </*0*/ F> bar6(/*0*/ x: F): kotlin.Unit
|
||||||
|
public fun </*0*/ F> bar7(/*0*/ x: F!!): kotlin.Unit
|
||||||
|
public fun </*0*/ F> bar8(/*0*/ x: F!!.() -> kotlin.Unit): kotlin.Unit
|
||||||
|
public fun </*0*/ T : kotlin.Any> foo(/*0*/ x: T, /*1*/ y: kotlin.collections.List<kotlin.String>): kotlin.Unit
|
||||||
|
public fun </*0*/ F> F!!.bar9(/*0*/ x: () -> kotlin.Unit): kotlin.Unit
|
||||||
|
|
||||||
Vendored
+36
@@ -0,0 +1,36 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
interface A<T> {
|
||||||
|
fun foo(x: T): T
|
||||||
|
fun bar(x: T & Any): T & Any
|
||||||
|
}
|
||||||
|
|
||||||
|
interface B<T1> : A<T1> {
|
||||||
|
override fun foo(x: T1): T1
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: T1 & Any): T1 & Any
|
||||||
|
}
|
||||||
|
|
||||||
|
interface C<T2> : A<T2> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: T2 & Any): T2 & Any
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: T2): T2
|
||||||
|
}
|
||||||
|
|
||||||
|
interface D : A<String?> {
|
||||||
|
override fun foo(x: String?): String?
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface E : A<String> {
|
||||||
|
override fun foo(x: String): String
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface F : A<String?> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: String): String
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String?): String?
|
||||||
|
}
|
||||||
|
|
||||||
|
interface G<T3 : Any> : A<T3> {
|
||||||
|
override fun foo(x: T3): T3
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: T3): T3
|
||||||
|
}
|
||||||
Vendored
+36
@@ -0,0 +1,36 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
interface A<T> {
|
||||||
|
fun foo(x: T): T
|
||||||
|
fun bar(x: T & Any): T & Any
|
||||||
|
}
|
||||||
|
|
||||||
|
interface B<T1> : A<T1> {
|
||||||
|
override fun foo(x: T1): T1
|
||||||
|
override fun bar(x: T1 & Any): T1 & Any
|
||||||
|
}
|
||||||
|
|
||||||
|
interface C<T2> : A<T2> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: T2 & Any): T2 & Any
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: T2): T2
|
||||||
|
}
|
||||||
|
|
||||||
|
interface D : A<String?> {
|
||||||
|
override fun foo(x: String?): String?
|
||||||
|
override fun bar(x: String): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface E : A<String> {
|
||||||
|
override fun foo(x: String): String
|
||||||
|
override fun bar(x: String): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface F : A<String?> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: String): String
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String?): String?
|
||||||
|
}
|
||||||
|
|
||||||
|
interface G<T3 : Any> : A<T3> {
|
||||||
|
override fun foo(x: T3): T3
|
||||||
|
override fun bar(x: T3): T3
|
||||||
|
}
|
||||||
Vendored
+61
@@ -0,0 +1,61 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public interface A</*0*/ T> {
|
||||||
|
public abstract fun bar(/*0*/ x: T!!): T!!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract fun foo(/*0*/ x: T): T
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface B</*0*/ T1> : A<T1> {
|
||||||
|
public abstract override /*1*/ fun bar(/*0*/ x: T1!!): T1!!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ fun foo(/*0*/ x: T1): T1
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface C</*0*/ T2> : A<T2> {
|
||||||
|
public abstract fun bar(/*0*/ x: T2): T2
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun bar(/*0*/ x: T2!!): T2!!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ x: T2): T2
|
||||||
|
public abstract fun foo(/*0*/ x: T2!!): T2!!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface D : A<kotlin.String?> {
|
||||||
|
public abstract override /*1*/ fun bar(/*0*/ x: kotlin.String): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ fun foo(/*0*/ x: kotlin.String?): kotlin.String?
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface E : A<kotlin.String> {
|
||||||
|
public abstract override /*1*/ fun bar(/*0*/ x: kotlin.String): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ fun foo(/*0*/ x: kotlin.String): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface F : A<kotlin.String?> {
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun bar(/*0*/ x: kotlin.String): kotlin.String
|
||||||
|
public abstract fun bar(/*0*/ x: kotlin.String?): kotlin.String?
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract fun foo(/*0*/ x: kotlin.String): kotlin.String
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ x: kotlin.String?): kotlin.String?
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface G</*0*/ T3 : kotlin.Any> : A<T3> {
|
||||||
|
public abstract override /*1*/ fun bar(/*0*/ x: T3): T3
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ fun foo(/*0*/ x: T3): T3
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
|
||||||
|
|
||||||
|
// FILE: A.java
|
||||||
|
import org.jetbrains.annotations.*;
|
||||||
|
|
||||||
|
public interface A<T> {
|
||||||
|
public T foo(T x) { return x; }
|
||||||
|
@NotNull
|
||||||
|
public T bar(@NotNull T x) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
interface B<T1> : A<T1> {
|
||||||
|
override fun foo(x: T1): T1
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: T1 & Any): T1 & Any
|
||||||
|
}
|
||||||
|
|
||||||
|
interface C<T2> : A<T2> {
|
||||||
|
override fun foo(x: T2 & Any): T2 & Any
|
||||||
|
override fun bar(x: T2): <!RETURN_TYPE_MISMATCH_ON_OVERRIDE!>T2<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface D : A<String?> {
|
||||||
|
override fun foo(x: String?): String?
|
||||||
|
override fun bar(x: String): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface E : A<String> {
|
||||||
|
override fun foo(x: String): String
|
||||||
|
override fun bar(x: String): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface F : A<String?> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: String): String
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String?): String?
|
||||||
|
}
|
||||||
|
|
||||||
|
interface G<T3 : Any> : A<T3> {
|
||||||
|
override fun foo(x: T3): T3
|
||||||
|
override fun bar(x: T3): T3
|
||||||
|
}
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
|
||||||
|
|
||||||
|
// FILE: A.java
|
||||||
|
import org.jetbrains.annotations.*;
|
||||||
|
|
||||||
|
public interface A<T> {
|
||||||
|
public T foo(T x) { return x; }
|
||||||
|
@NotNull
|
||||||
|
public T bar(@NotNull T x) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
interface B<T1> : A<T1> {
|
||||||
|
override fun foo(x: T1): T1
|
||||||
|
override fun bar(x: T1 & Any): T1 & Any
|
||||||
|
}
|
||||||
|
|
||||||
|
interface C<T2> : A<T2> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: T2 & Any): T2 & Any
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: T2): T2
|
||||||
|
}
|
||||||
|
|
||||||
|
interface D : A<String?> {
|
||||||
|
override fun foo(x: String?): String?
|
||||||
|
override fun bar(x: String): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface E : A<String> {
|
||||||
|
override fun foo(x: String): String
|
||||||
|
override fun bar(x: String): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface F : A<String?> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: String): String
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String?): String?
|
||||||
|
}
|
||||||
|
|
||||||
|
interface G<T3 : Any> : A<T3> {
|
||||||
|
override fun foo(x: T3): T3
|
||||||
|
override fun bar(x: T3): T3
|
||||||
|
}
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public interface A</*0*/ T : kotlin.Any!> {
|
||||||
|
@org.jetbrains.annotations.NotNull public abstract fun bar(/*0*/ @org.jetbrains.annotations.NotNull x: T!!): T!!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract fun foo(/*0*/ x: T!): T!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface B</*0*/ T1> : A<T1> {
|
||||||
|
public abstract override /*1*/ fun bar(/*0*/ x: T1!!): T1!!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ fun foo(/*0*/ x: T1): T1
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface C</*0*/ T2> : A<T2> {
|
||||||
|
public abstract fun bar(/*0*/ x: T2): T2
|
||||||
|
@org.jetbrains.annotations.NotNull public abstract override /*1*/ /*fake_override*/ fun bar(/*0*/ @org.jetbrains.annotations.NotNull x: T2!!): T2!!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ x: T2!): T2!
|
||||||
|
public abstract fun foo(/*0*/ x: T2!!): T2!!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface D : A<kotlin.String?> {
|
||||||
|
public abstract override /*1*/ fun bar(/*0*/ x: kotlin.String): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ fun foo(/*0*/ x: kotlin.String?): kotlin.String?
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface E : A<kotlin.String> {
|
||||||
|
public abstract override /*1*/ fun bar(/*0*/ x: kotlin.String): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ fun foo(/*0*/ x: kotlin.String): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface F : A<kotlin.String?> {
|
||||||
|
@org.jetbrains.annotations.NotNull public abstract override /*1*/ /*fake_override*/ fun bar(/*0*/ @org.jetbrains.annotations.NotNull x: kotlin.String): kotlin.String
|
||||||
|
public abstract fun bar(/*0*/ x: kotlin.String?): kotlin.String?
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract fun foo(/*0*/ x: kotlin.String): kotlin.String
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ x: kotlin.String?): kotlin.String?
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface G</*0*/ T3 : kotlin.Any> : A<T3> {
|
||||||
|
public abstract override /*1*/ fun bar(/*0*/ x: T3): T3
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ fun foo(/*0*/ x: T3): T3
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
Vendored
+14
@@ -0,0 +1,14 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun <T> foo(x: T, y: T & Any): T & Any = x ?: y
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
foo<String>("", "").<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
foo<String>("", null).<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
foo<String?>(null, "").<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
foo<String?>(null, null).<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
|
||||||
|
foo("", "").<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
foo("", null).<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
foo(null, "").<!UNRESOLVED_REFERENCE!>length<!>
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||||
|
|
||||||
|
fun <T> foo(x: T, y: T & Any): T & Any = x ?: y
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
foo<String>("", "").length
|
||||||
|
foo<String>("", <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||||
|
foo<String?>(null, "").length
|
||||||
|
foo<String?>(null, <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||||
|
|
||||||
|
foo("", "").length
|
||||||
|
foo("", <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||||
|
foo(null, "").length
|
||||||
|
}
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun </*0*/ T> foo(/*0*/ x: T, /*1*/ y: T!!): T!!
|
||||||
|
public fun main(): kotlin.Unit
|
||||||
+1
-1
@@ -2,4 +2,4 @@
|
|||||||
// COMPILER_ARGUMENTS: -XXLanguage:+DefinitelyNotNullTypeParameters
|
// COMPILER_ARGUMENTS: -XXLanguage:+DefinitelyNotNullTypeParameters
|
||||||
package test
|
package test
|
||||||
|
|
||||||
fun <T> foo(x: T!!, y: List<T!!>, z: (T!!) -> T!!): T!! = x
|
fun <T> foo(x: T & Any, y: List<T & Any>, z: (T & Any) -> T & Any): T & Any = x
|
||||||
|
|||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
fun <T> foo1(x: @ann T & Any) {}
|
||||||
|
fun <T> foo2(x: List<@ann T & Any>) {}
|
||||||
|
fun <T> foo3(x: List<out @ann T & Any>) {}
|
||||||
|
fun <T> foo4(x: @ann (T & Any)) {}
|
||||||
|
fun <T> foo5(x: @ann T? & Any?) {}
|
||||||
|
fun <T> foo6(x: @ann T & Any & Any) {}
|
||||||
|
fun <T> foo7(x: @ann T & (Any & Any)) {}
|
||||||
|
fun <T> @ann (T & Any).foo8() {}
|
||||||
|
fun <T> foo10(x: @ann T & Any.() -> Unit) {}
|
||||||
|
fun <T> foo11(x: @ann (T & Any).() -> Unit) {}
|
||||||
+523
@@ -0,0 +1,523 @@
|
|||||||
|
KtFile: AnnotatedIntersections.kt
|
||||||
|
PACKAGE_DIRECTIVE
|
||||||
|
<empty list>
|
||||||
|
IMPORT_LIST
|
||||||
|
<empty list>
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo1')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
MODIFIER_LIST
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo2')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('List')
|
||||||
|
TYPE_ARGUMENT_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PROJECTION
|
||||||
|
TYPE_REFERENCE
|
||||||
|
MODIFIER_LIST
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo3')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('List')
|
||||||
|
TYPE_ARGUMENT_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PROJECTION
|
||||||
|
MODIFIER_LIST
|
||||||
|
PsiElement(out)('out')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
MODIFIER_LIST
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo4')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
MODIFIER_LIST
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo5')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
MODIFIER_LIST
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
NULLABLE_TYPE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
NULLABLE_TYPE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo6')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
MODIFIER_LIST
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo7')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
MODIFIER_LIST
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Annotations are not allowed in this position
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting ')'
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiErrorElement:Expecting '('
|
||||||
|
<empty list>
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('foo8')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUN
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
<empty list>
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo10')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
MODIFIER_LIST
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
FUNCTION_TYPE
|
||||||
|
FUNCTION_TYPE_RECEIVER
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Unit')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo11')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
MODIFIER_LIST
|
||||||
|
ANNOTATION_ENTRY
|
||||||
|
PsiElement(AT)('@')
|
||||||
|
CONSTRUCTOR_CALLEE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('ann')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_TYPE
|
||||||
|
FUNCTION_TYPE_RECEIVER
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Unit')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
+150
-156
@@ -19,77 +19,75 @@ KtFile: DefinitelyNotNullType.kt
|
|||||||
PsiElement(IDENTIFIER)('x')
|
PsiElement(IDENTIFIER)('x')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
VALUE_PARAMETER
|
|
||||||
PsiElement(IDENTIFIER)('y')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
TYPE_REFERENCE
|
||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('List')
|
PsiElement(IDENTIFIER)('T')
|
||||||
TYPE_ARGUMENT_LIST
|
PsiErrorElement:Expecting comma or ')'
|
||||||
PsiElement(LT)('<')
|
<empty list>
|
||||||
TYPE_PROJECTION
|
PsiErrorElement:Expecting ')'
|
||||||
TYPE_REFERENCE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
|
||||||
PsiElement(GT)('>')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
VALUE_PARAMETER
|
|
||||||
PsiElement(IDENTIFIER)('z')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
|
||||||
FUNCTION_TYPE
|
|
||||||
FUNCTION_TYPE_RECEIVER
|
|
||||||
TYPE_REFERENCE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
|
||||||
PsiElement(DOT)('.')
|
|
||||||
VALUE_PARAMETER_LIST
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
VALUE_PARAMETER
|
|
||||||
TYPE_REFERENCE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
PsiElement(EXCLEXCL)('!!')
|
||||||
PsiWhiteSpace(' ')
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('List')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(EXCLEXCL)('!!')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('z')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(EXCLEXCL)('!!')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(EXCLEXCL)('!!')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(EXCLEXCL)('!!')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(EXCLEXCL)('!!')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUN
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
<empty list>
|
||||||
BLOCK
|
BLOCK
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
@@ -112,99 +110,95 @@ KtFile: DefinitelyNotNullType.kt
|
|||||||
PsiElement(IDENTIFIER)('x')
|
PsiElement(IDENTIFIER)('x')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
TYPE_REFERENCE
|
|
||||||
NULLABLE_TYPE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
|
||||||
PsiElement(QUEST)('?')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
VALUE_PARAMETER
|
|
||||||
PsiElement(IDENTIFIER)('y')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
TYPE_REFERENCE
|
||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('List')
|
PsiElement(IDENTIFIER)('T')
|
||||||
TYPE_ARGUMENT_LIST
|
PsiErrorElement:Expecting comma or ')'
|
||||||
PsiElement(LT)('<')
|
<empty list>
|
||||||
TYPE_PROJECTION
|
PsiErrorElement:Expecting ')'
|
||||||
TYPE_REFERENCE
|
|
||||||
NULLABLE_TYPE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
|
||||||
PsiElement(QUEST)('?')
|
|
||||||
PsiElement(GT)('>')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
VALUE_PARAMETER
|
|
||||||
PsiElement(IDENTIFIER)('z')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
|
||||||
FUNCTION_TYPE
|
|
||||||
FUNCTION_TYPE_RECEIVER
|
|
||||||
TYPE_REFERENCE
|
|
||||||
NULLABLE_TYPE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
|
||||||
PsiElement(QUEST)('?')
|
|
||||||
PsiElement(DOT)('.')
|
|
||||||
VALUE_PARAMETER_LIST
|
|
||||||
PsiElement(LPAR)('(')
|
|
||||||
VALUE_PARAMETER
|
|
||||||
TYPE_REFERENCE
|
|
||||||
NULLABLE_TYPE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
|
||||||
PsiElement(QUEST)('?')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
PsiElement(ARROW)('->')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
|
||||||
NULLABLE_TYPE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
|
||||||
PsiElement(QUEST)('?')
|
|
||||||
PsiElement(COMMA)(',')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
VALUE_PARAMETER
|
|
||||||
PsiElement(IDENTIFIER)('w')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('String')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
|
||||||
PsiElement(RPAR)(')')
|
|
||||||
PsiElement(COLON)(':')
|
|
||||||
PsiWhiteSpace(' ')
|
|
||||||
TYPE_REFERENCE
|
|
||||||
DEFINITELY_NOT_NULL_TYPE
|
|
||||||
USER_TYPE
|
|
||||||
REFERENCE_EXPRESSION
|
|
||||||
PsiElement(IDENTIFIER)('T')
|
|
||||||
PsiElement(EXCLEXCL)('!!')
|
PsiElement(EXCLEXCL)('!!')
|
||||||
PsiWhiteSpace(' ')
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('List')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(EXCLEXCL)('!!')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('z')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(EXCLEXCL)('!!')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(SAFE_ACCESS)('?.')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(EXCLEXCL)('!!')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(EXCLEXCL)('!!')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('w')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('String')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(EXCLEXCL)('!!')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(EXCLEXCL)('!!')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUN
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
<empty list>
|
||||||
BLOCK
|
BLOCK
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
|
|||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
fun <T> foo1(x: T & Any) {}
|
||||||
|
fun <T> foo2(x: List<T & Any>) {}
|
||||||
|
fun <T> foo3(x: List<out T & Any>) {}
|
||||||
|
fun <T> foo4(x: (T & Any)) {}
|
||||||
|
fun <T> foo5(x: T? & Any?) {}
|
||||||
|
fun <T> foo6(x: T & Any & Any) {}
|
||||||
|
fun <T> foo7(x: T & (Any & Any)) {}
|
||||||
|
fun <T> T & Any.foo8() {}
|
||||||
|
fun <T> (T & Any).foo9() {}
|
||||||
|
fun <T> foo10(x: T & Any.() -> Unit) {}
|
||||||
|
fun <T> foo11(x: (T & Any).() -> Unit) {}
|
||||||
+462
@@ -0,0 +1,462 @@
|
|||||||
|
KtFile: SimpleIntersections.kt
|
||||||
|
PACKAGE_DIRECTIVE
|
||||||
|
<empty list>
|
||||||
|
IMPORT_LIST
|
||||||
|
<empty list>
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo1')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo2')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('List')
|
||||||
|
TYPE_ARGUMENT_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PROJECTION
|
||||||
|
TYPE_REFERENCE
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo3')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('List')
|
||||||
|
TYPE_ARGUMENT_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PROJECTION
|
||||||
|
MODIFIER_LIST
|
||||||
|
PsiElement(out)('out')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo4')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo5')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
NULLABLE_TYPE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
NULLABLE_TYPE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo6')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo7')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiErrorElement:Expecting '('
|
||||||
|
<empty list>
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(IDENTIFIER)('foo8')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUN
|
||||||
|
PsiErrorElement:Expecting a top level declaration
|
||||||
|
<empty list>
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
PsiElement(IDENTIFIER)('foo9')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo10')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
FUNCTION_TYPE
|
||||||
|
FUNCTION_TYPE_RECEIVER
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Unit')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo11')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
FUNCTION_TYPE
|
||||||
|
FUNCTION_TYPE_RECEIVER
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
INTERSECTION_TYPE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(AND)('&')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Any')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Unit')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
+10
-10
@@ -1,33 +1,33 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
interface A<T> {
|
interface A<T> {
|
||||||
fun foo(x: T!!)
|
fun foo(x: T & Any)
|
||||||
|
|
||||||
val w: T!!
|
val w: T & Any
|
||||||
}
|
}
|
||||||
|
|
||||||
class B<X>(r: X!!)
|
class B<X>(r: X & Any)
|
||||||
|
|
||||||
fun <K> inside() {
|
fun <K> inside() {
|
||||||
object : A<K> {
|
object : A<K> {
|
||||||
override fun foo(x: K!!) {
|
override fun foo(x: K & Any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override val w: K!!
|
override val w: K & Any
|
||||||
get() = TODO("")
|
get() = TODO("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <F> bar1(x: F!!) {}
|
fun <F> bar1(x: F & Any) {}
|
||||||
fun <F> bar2(x: F) = x!!
|
fun <F> bar2(x: F) = x!!
|
||||||
|
|
||||||
val <E> E.nn: E!! get() = this!!
|
val <E> E.nn: E & Any get() = this!!
|
||||||
|
|
||||||
class Outer {
|
class Outer {
|
||||||
abstract class R1<T, F : T!!> : A<T!!>
|
abstract class R1<T, F : T & Any> : A<T & Any>
|
||||||
abstract class R2<T, F : T!!> : A<T>
|
abstract class R2<T, F : T & Any> : A<T>
|
||||||
|
|
||||||
abstract class W<T> : A<T>
|
abstract class W<T> : A<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
typealias Alias<R> = A<R!!>
|
typealias Alias<R> = A<R & Any>
|
||||||
|
|||||||
Generated
+70
@@ -10122,6 +10122,76 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class ExplicitDefinitelyNotNullableViaIntersection {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInExplicitDefinitelyNotNullableViaIntersection() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("approximation.kt")
|
||||||
|
public void testApproximation() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/approximation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("bareTypes.kt")
|
||||||
|
public void testBareTypes() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/bareTypes.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("disabledFeature.kt")
|
||||||
|
public void testDisabledFeature() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inference.kt")
|
||||||
|
public void testInference() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/inference.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("isAsOperators.kt")
|
||||||
|
public void testIsAsOperators() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/isAsOperators.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("isAsOperatorsEnabled.kt")
|
||||||
|
public void testIsAsOperatorsEnabled() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/isAsOperatorsEnabled.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("notApplicable.kt")
|
||||||
|
public void testNotApplicable() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/notApplicable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overrides.kt")
|
||||||
|
public void testOverrides() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/overrides.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overridesJavaAnnotated.kt")
|
||||||
|
public void testOverridesJavaAnnotated() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/overridesJavaAnnotated.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("simple.kt")
|
||||||
|
public void testSimple() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/simple.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+6
@@ -799,6 +799,12 @@ public abstract class KtUsefulTestCase extends TestCase {
|
|||||||
fileText = FileUtil.loadFile(new File(filePath), StandardCharsets.UTF_8);
|
fileText = FileUtil.loadFile(new File(filePath), StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e) {
|
catch (FileNotFoundException e) {
|
||||||
|
try {
|
||||||
|
FileUtil.writeToFile(new File(filePath), actualText);
|
||||||
|
}
|
||||||
|
catch (IOException exception) {
|
||||||
|
throw new AssertionError(exception);
|
||||||
|
}
|
||||||
throw new AssertionFailedError("No output text found. File " + filePath + " created.");
|
throw new AssertionFailedError("No output text found. File " + filePath + " created.");
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ public class ParsingTestGenerated extends AbstractParsingTest {
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/psi"), Pattern.compile("^(.*)\\.kts?$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/psi"), Pattern.compile("^(.*)\\.kts?$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnnotatedIntersections.kt")
|
||||||
|
public void testAnnotatedIntersections() throws Exception {
|
||||||
|
runTest("compiler/testData/psi/AnnotatedIntersections.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("AnonymousInitializer.kt")
|
@TestMetadata("AnonymousInitializer.kt")
|
||||||
public void testAnonymousInitializer() throws Exception {
|
public void testAnonymousInitializer() throws Exception {
|
||||||
runTest("compiler/testData/psi/AnonymousInitializer.kt");
|
runTest("compiler/testData/psi/AnonymousInitializer.kt");
|
||||||
@@ -626,6 +631,11 @@ public class ParsingTestGenerated extends AbstractParsingTest {
|
|||||||
runTest("compiler/testData/psi/SimpleExpressions.kt");
|
runTest("compiler/testData/psi/SimpleExpressions.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("SimpleIntersections.kt")
|
||||||
|
public void testSimpleIntersections() throws Exception {
|
||||||
|
runTest("compiler/testData/psi/SimpleIntersections.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SimpleModifiers.kt")
|
@TestMetadata("SimpleModifiers.kt")
|
||||||
public void testSimpleModifiers() throws Exception {
|
public void testSimpleModifiers() throws Exception {
|
||||||
runTest("compiler/testData/psi/SimpleModifiers.kt");
|
runTest("compiler/testData/psi/SimpleModifiers.kt");
|
||||||
|
|||||||
@@ -24,11 +24,13 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
|||||||
import org.jetbrains.kotlin.resolve.calls.inference.isCaptured
|
import org.jetbrains.kotlin.resolve.calls.inference.isCaptured
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import org.jetbrains.kotlin.types.checker.*
|
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||||
|
import org.jetbrains.kotlin.types.checker.NewCapturedType
|
||||||
|
import org.jetbrains.kotlin.types.checker.NewCapturedTypeConstructor
|
||||||
|
import org.jetbrains.kotlin.types.checker.intersectTypes
|
||||||
import org.jetbrains.kotlin.types.model.TypeArgumentMarker
|
import org.jetbrains.kotlin.types.model.TypeArgumentMarker
|
||||||
import org.jetbrains.kotlin.types.model.TypeVariableTypeConstructorMarker
|
import org.jetbrains.kotlin.types.model.TypeVariableTypeConstructorMarker
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
enum class TypeNullability {
|
enum class TypeNullability {
|
||||||
NOT_NULL,
|
NOT_NULL,
|
||||||
@@ -58,6 +60,7 @@ fun KotlinType.isNullableNothing(): Boolean = KotlinBuiltIns.isNullableNothing(t
|
|||||||
fun KotlinType.isNothingOrNullableNothing(): Boolean = KotlinBuiltIns.isNothingOrNullableNothing(this)
|
fun KotlinType.isNothingOrNullableNothing(): Boolean = KotlinBuiltIns.isNothingOrNullableNothing(this)
|
||||||
fun KotlinType.isUnit(): Boolean = KotlinBuiltIns.isUnit(this)
|
fun KotlinType.isUnit(): Boolean = KotlinBuiltIns.isUnit(this)
|
||||||
fun KotlinType.isAnyOrNullableAny(): Boolean = KotlinBuiltIns.isAnyOrNullableAny(this)
|
fun KotlinType.isAnyOrNullableAny(): Boolean = KotlinBuiltIns.isAnyOrNullableAny(this)
|
||||||
|
fun KotlinType.isAny(): Boolean = KotlinBuiltIns.isAny(this)
|
||||||
fun KotlinType.isNullableAny(): Boolean = KotlinBuiltIns.isNullableAny(this)
|
fun KotlinType.isNullableAny(): Boolean = KotlinBuiltIns.isNullableAny(this)
|
||||||
fun KotlinType.isBoolean(): Boolean = KotlinBuiltIns.isBoolean(this)
|
fun KotlinType.isBoolean(): Boolean = KotlinBuiltIns.isBoolean(this)
|
||||||
fun KotlinType.isPrimitiveNumberType(): Boolean = KotlinBuiltIns.isPrimitiveType(this) && !isBoolean()
|
fun KotlinType.isPrimitiveNumberType(): Boolean = KotlinBuiltIns.isPrimitiveType(this) && !isBoolean()
|
||||||
|
|||||||
+70
@@ -10116,6 +10116,76 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class ExplicitDefinitelyNotNullableViaIntersection {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInExplicitDefinitelyNotNullableViaIntersection() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("approximation.kt")
|
||||||
|
public void testApproximation() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/approximation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("bareTypes.kt")
|
||||||
|
public void testBareTypes() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/bareTypes.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("disabledFeature.kt")
|
||||||
|
public void testDisabledFeature() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/disabledFeature.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inference.kt")
|
||||||
|
public void testInference() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/inference.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("isAsOperators.kt")
|
||||||
|
public void testIsAsOperators() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/isAsOperators.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("isAsOperatorsEnabled.kt")
|
||||||
|
public void testIsAsOperatorsEnabled() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/isAsOperatorsEnabled.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("notApplicable.kt")
|
||||||
|
public void testNotApplicable() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/notApplicable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overrides.kt")
|
||||||
|
public void testOverrides() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/overrides.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overridesJavaAnnotated.kt")
|
||||||
|
public void testOverridesJavaAnnotated() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/overridesJavaAnnotated.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("simple.kt")
|
||||||
|
public void testSimple() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/simple.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
@TestMetadata("compiler/testData/diagnostics/tests/exposed")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
Reference in New Issue
Block a user