1/2 analysis-api: Initial implementation for contracts
Review: https://jetbrains.team/p/kt/reviews/7652 I need this API for KTIJ-22692
This commit is contained in:
analysis/analysis-api/testData/symbols/singleSymbolByPsi/contracts/booleanConstReferenceInImplies.kt
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun booleanConstReferenceInImplies(): Boolean {
|
||||
contr<caret>act {
|
||||
returns(true) implies true
|
||||
}
|
||||
return true
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun booleanConstReferenceInImplies(): kotlin.Boolean
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /booleanConstReferenceInImplies
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractConditionalContractEffectDeclaration:
|
||||
effect:
|
||||
KtContractReturnsSpecificValueEffectDeclaration:
|
||||
value:
|
||||
KtContractConstantValue:
|
||||
constantType: TRUE
|
||||
condition:
|
||||
KtContractBooleanConstantExpression:
|
||||
booleanConstant: true
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: booleanConstReferenceInImplies
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Boolean
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun boolenExprContract(foo: Any?, bar: Any?): Boolean {
|
||||
contr<caret>act {
|
||||
returns(true) implies (foo == null && bar != null)
|
||||
}
|
||||
return foo == null && bar != null
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun boolenExprContract(foo: kotlin.Any?, bar: kotlin.Any?): kotlin.Boolean
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /boolenExprContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractConditionalContractEffectDeclaration:
|
||||
effect:
|
||||
KtContractReturnsSpecificValueEffectDeclaration:
|
||||
value:
|
||||
KtContractConstantValue:
|
||||
constantType: TRUE
|
||||
condition:
|
||||
KtContractBinaryLogicExpression:
|
||||
left:
|
||||
KtContractIsNullPredicateExpression:
|
||||
argument:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
isNegated: false
|
||||
right:
|
||||
KtContractIsNullPredicateExpression:
|
||||
argument:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: bar
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
isNegated: true
|
||||
operation: AND
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: boolenExprContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Boolean
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: bar
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun atLeastOnceContract(block: () -> Unit) {
|
||||
contr<caret>act {
|
||||
callsInPlace(block, InvocationKind.AT_LEAST_ONCE)
|
||||
}
|
||||
block()
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun atLeastOnceContract(block: () -> kotlin.Unit)
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /atLeastOnceContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractCallsInPlaceContractEffectDeclaration:
|
||||
valueParameterReference:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: block
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Function0<kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
occurrencesRange: AT_LEAST_ONCE
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: atLeastOnceContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: block
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Function0<kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
analysis/analysis-api/testData/symbols/singleSymbolByPsi/contracts/callsInPlaceAtMostOnceContract.kt
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun atMostOnceContract(block: () -> Unit) {
|
||||
contr<caret>act {
|
||||
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
|
||||
}
|
||||
block()
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun atMostOnceContract(block: () -> kotlin.Unit)
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /atMostOnceContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractCallsInPlaceContractEffectDeclaration:
|
||||
valueParameterReference:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: block
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Function0<kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
occurrencesRange: AT_MOST_ONCE
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: atMostOnceContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: block
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Function0<kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun exactlyOnceContract(block: () -> Unit) {
|
||||
contr<caret>act {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
block()
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun exactlyOnceContract(block: () -> kotlin.Unit)
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /exactlyOnceContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractCallsInPlaceContractEffectDeclaration:
|
||||
valueParameterReference:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: block
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Function0<kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
occurrencesRange: EXACTLY_ONCE
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: exactlyOnceContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: block
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Function0<kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun unknownContract(block: () -> Unit) {
|
||||
contr<caret>act {
|
||||
callsInPlace(block, InvocationKind.UNKNOWN)
|
||||
}
|
||||
block()
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun unknownContract(block: () -> kotlin.Unit)
|
||||
Vendored
+74
@@ -0,0 +1,74 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /unknownContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractCallsInPlaceContractEffectDeclaration:
|
||||
valueParameterReference:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: block
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Function0<kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
occurrencesRange: UNKNOWN
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: unknownContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: block
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Function0<kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun invalidContract(foo: Any, bar: Boolean) {
|
||||
cont<caret>ract {
|
||||
returns(foo) implies bar
|
||||
}
|
||||
return if (bar) foo else null
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun invalidContract(foo: kotlin.Any, bar: kotlin.Boolean)
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /invalidContract
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: invalidContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: bar
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Boolean
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
class Foo
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun isInstancePredicateContract(value: Any) {
|
||||
contr<caret>act {
|
||||
returns() implies (value is Foo)
|
||||
}
|
||||
if (value !is Foo) {
|
||||
throw IllegalStateException()
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun isInstancePredicateContract(value: kotlin.Any)
|
||||
Vendored
+80
@@ -0,0 +1,80 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /isInstancePredicateContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractConditionalContractEffectDeclaration:
|
||||
effect:
|
||||
KtContractReturnsSuccessfullyEffectDeclaration:
|
||||
condition:
|
||||
KtContractIsInstancePredicateExpression:
|
||||
argument:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: value
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
type:
|
||||
Foo
|
||||
isNegated: false
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: isInstancePredicateContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: value
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun logicalNotContract(value: Boolean) {
|
||||
contr<caret>act {
|
||||
returns() implies !value
|
||||
}
|
||||
if (value) {
|
||||
throw IllegalStateException()
|
||||
}
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun logicalNotContract(value: kotlin.Boolean)
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /logicalNotContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractConditionalContractEffectDeclaration:
|
||||
effect:
|
||||
KtContractReturnsSuccessfullyEffectDeclaration:
|
||||
condition:
|
||||
KtContractLogicalNotExpression:
|
||||
argument:
|
||||
KtContractBooleanValueParameterExpression:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: value
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Boolean
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: logicalNotContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: value
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Boolean
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import java.lang.IllegalStateException
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun Boolean.referenceReceiverInContract() {
|
||||
contr<caret>act {
|
||||
returns() implies this@referenceReceiverInContract
|
||||
}
|
||||
if (!this) throw IllegalStateException()
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun kotlin.Boolean.referenceReceiverInContract()
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /referenceReceiverInContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractConditionalContractEffectDeclaration:
|
||||
effect:
|
||||
KtContractReturnsSuccessfullyEffectDeclaration:
|
||||
condition:
|
||||
KtContractBooleanValueParameterExpression:
|
||||
parameterSymbol:
|
||||
KtReceiverParameterSymbol:
|
||||
annotationsList: []
|
||||
origin: SOURCE
|
||||
owningCallableSymbol: KtFunctionSymbol(/referenceReceiverInContract)
|
||||
type: kotlin/Boolean
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: true
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: referenceReceiverInContract
|
||||
origin: SOURCE
|
||||
receiverParameter: KtReceiverParameterSymbol:
|
||||
annotationsList: []
|
||||
origin: SOURCE
|
||||
owningCallableSymbol: KtFunctionSymbol(/referenceReceiverInContract)
|
||||
type: kotlin/Boolean
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
returnType: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun (() -> Unit).referenceReceiverInContract() {
|
||||
contr<caret>act {
|
||||
callsInPlace(this@referenceReceiverInContract, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
this()
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun () -> kotlin.Unit.referenceReceiverInContract()
|
||||
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /referenceReceiverInContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractCallsInPlaceContractEffectDeclaration:
|
||||
valueParameterReference:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtReceiverParameterSymbol:
|
||||
annotationsList: []
|
||||
origin: SOURCE
|
||||
owningCallableSymbol: KtFunctionSymbol(/referenceReceiverInContract)
|
||||
type: kotlin/Function0<kotlin/Unit>
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
occurrencesRange: EXACTLY_ONCE
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: true
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: referenceReceiverInContract
|
||||
origin: SOURCE
|
||||
receiverParameter: KtReceiverParameterSymbol:
|
||||
annotationsList: []
|
||||
origin: SOURCE
|
||||
owningCallableSymbol: KtFunctionSymbol(/referenceReceiverInContract)
|
||||
type: kotlin/Function0<kotlin/Unit>
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
returnType: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
inline fun check(value: Boolean) {
|
||||
contr<caret>act {
|
||||
returns() implies value
|
||||
}
|
||||
if (!value) {
|
||||
throw IllegalStateException()
|
||||
}
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
inline fun check(value: kotlin.Boolean)
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /check
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractConditionalContractEffectDeclaration:
|
||||
effect:
|
||||
KtContractReturnsSuccessfullyEffectDeclaration:
|
||||
condition:
|
||||
KtContractBooleanValueParameterExpression:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: value
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Boolean
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: true
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: check
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Unit
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: value
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Boolean
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun returnsFalseContract(foo: Any?): Boolean {
|
||||
contr<caret>act {
|
||||
returns(false) implies (foo != null)
|
||||
}
|
||||
return foo == null
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun returnsFalseContract(foo: kotlin.Any?): kotlin.Boolean
|
||||
Vendored
+81
@@ -0,0 +1,81 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /returnsFalseContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractConditionalContractEffectDeclaration:
|
||||
effect:
|
||||
KtContractReturnsSpecificValueEffectDeclaration:
|
||||
value:
|
||||
KtContractConstantValue:
|
||||
constantType: FALSE
|
||||
condition:
|
||||
KtContractIsNullPredicateExpression:
|
||||
argument:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
isNegated: true
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: returnsFalseContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Boolean
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun returnsNotNullContract(foo: Any?): Any? {
|
||||
contr<caret>act {
|
||||
returnsNotNull() implies (foo != null)
|
||||
}
|
||||
return foo
|
||||
}
|
||||
analysis/analysis-api/testData/symbols/singleSymbolByPsi/contracts/returnsNotNullContract.pretty.txt
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun returnsNotNullContract(foo: kotlin.Any?): kotlin.Any?
|
||||
Vendored
+78
@@ -0,0 +1,78 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /returnsNotNullContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractConditionalContractEffectDeclaration:
|
||||
effect:
|
||||
KtContractReturnsNotNullEffectDeclaration:
|
||||
condition:
|
||||
KtContractIsNullPredicateExpression:
|
||||
argument:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
isNegated: true
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: returnsNotNullContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun returnsNullContract(foo: Any?): Any? {
|
||||
contr<caret>act {
|
||||
returns(null) implies (foo == null)
|
||||
}
|
||||
return foo
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun returnsNullContract(foo: kotlin.Any?): kotlin.Any?
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /returnsNullContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractConditionalContractEffectDeclaration:
|
||||
effect:
|
||||
KtContractReturnsSpecificValueEffectDeclaration:
|
||||
value:
|
||||
KtContractConstantValue:
|
||||
constantType: NULL
|
||||
condition:
|
||||
KtContractIsNullPredicateExpression:
|
||||
argument:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
isNegated: false
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: returnsNullContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun returnsTrueContract(foo: Any?): Boolean {
|
||||
contr<caret>act {
|
||||
returns(true) implies (foo == null)
|
||||
}
|
||||
return foo == null
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun returnsTrueContract(foo: kotlin.Any?): kotlin.Boolean
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /returnsTrueContract
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractConditionalContractEffectDeclaration:
|
||||
effect:
|
||||
KtContractReturnsSpecificValueEffectDeclaration:
|
||||
value:
|
||||
KtContractConstantValue:
|
||||
constantType: TRUE
|
||||
condition:
|
||||
KtContractIsNullPredicateExpression:
|
||||
argument:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
isNegated: false
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: returnsTrueContract
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Boolean
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// WITH_STDLIB
|
||||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun twoContracts(foo: Any?, bar: Any?, block: () -> Unit): Boolean {
|
||||
contr<caret>act {
|
||||
returns(true) implies (foo == null && bar != null)
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
block()
|
||||
return foo == null && bar != null
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
fun twoContracts(foo: kotlin.Any?, bar: kotlin.Any?, block: () -> kotlin.Unit): kotlin.Boolean
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
KtFunctionSymbol:
|
||||
annotationsList: [
|
||||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class])
|
||||
psi: KtAnnotationEntry
|
||||
]
|
||||
callableIdIfNonLocal: /twoContracts
|
||||
contextReceivers: []
|
||||
contractEffects: [
|
||||
KtContractConditionalContractEffectDeclaration:
|
||||
effect:
|
||||
KtContractReturnsSpecificValueEffectDeclaration:
|
||||
value:
|
||||
KtContractConstantValue:
|
||||
constantType: TRUE
|
||||
condition:
|
||||
KtContractBinaryLogicExpression:
|
||||
left:
|
||||
KtContractIsNullPredicateExpression:
|
||||
argument:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
isNegated: false
|
||||
right:
|
||||
KtContractIsNullPredicateExpression:
|
||||
argument:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: bar
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
isNegated: true
|
||||
operation: AND
|
||||
KtContractCallsInPlaceContractEffectDeclaration:
|
||||
valueParameterReference:
|
||||
KtContractParameterValue:
|
||||
parameterSymbol:
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: block
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Function0<kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
occurrencesRange: EXACTLY_ONCE
|
||||
]
|
||||
hasStableParameterNames: true
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: twoContracts
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Boolean
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
valueParameters: [
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: foo
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: bar
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Any?
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
KtValueParameterSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: null
|
||||
contextReceivers: []
|
||||
generatedPrimaryConstructorProperty: null
|
||||
hasDefaultValue: false
|
||||
isCrossinline: false
|
||||
isExtension: false
|
||||
isImplicitLambdaParameter: false
|
||||
isNoinline: false
|
||||
isVararg: false
|
||||
name: block
|
||||
origin: SOURCE
|
||||
receiverParameter: null
|
||||
returnType: kotlin/Function0<kotlin/Unit>
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
]
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
deprecationStatus: null
|
||||
Reference in New Issue
Block a user