-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Analysis API] add test on contract with dispatch receiver cast
^KT-75123
- Loading branch information
1 parent
5c09cae
commit fd275e9
Showing
7 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...erated/cases/symbols/Fe10IdeNormalAnalysisSourceModuleSingleSymbolByPsiTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
...nerated/cases/symbols/FirIdeNormalAnalysisSourceModuleSingleSymbolByPsiTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
.../cases/symbols/FirStandaloneNormalAnalysisSourceModuleSingleSymbolByPsiTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
...-api/testData/symbols/singleSymbolByPsi/contracts/castForDispatchReceiver.descriptors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
KaNamedFunctionSymbol: | ||
annotations: [ | ||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class]) | ||
psi: KtAnnotationEntry | ||
] | ||
callableId: /Result.isFailure | ||
compilerVisibility: Public | ||
contextParameters: [] | ||
contextReceivers: [] | ||
contractEffects: [ | ||
KaContractConditionalContractEffectDeclaration: | ||
effect: | ||
KaContractReturnsSuccessfullyEffectDeclaration: | ||
condition: | ||
KaContractIsInstancePredicateExpression: | ||
argument: | ||
KaContractParameterValue: | ||
parameterSymbol: | ||
KaReceiverParameterSymbol: | ||
annotations: [] | ||
callableId: null | ||
compilerVisibility: Local | ||
contextReceivers: [] | ||
isActual: false | ||
isExpect: false | ||
isExtension: false | ||
isVal: true | ||
location: LOCAL | ||
modality: FINAL | ||
name: <receiver> | ||
origin: SOURCE | ||
owningCallableSymbol: Could not render due to java.lang.ClassCastException: org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.KaFe10DescNamedClassSymbol cannot be cast to org.jetbrains.kotlin.analysis.api.symbols.KaCallableSymbol | ||
|
||
receiverParameter: null | ||
returnType: KaUsualClassType: | ||
annotations: [] | ||
typeArguments: [] | ||
type: Result | ||
visibility: LOCAL | ||
getContainingFileSymbol: KaFileSymbol(castForDispatchReceiver.kt) | ||
getContainingJvmClassName: null | ||
getContainingModule: KaSourceModule "Sources of main" | ||
deprecationStatus: null | ||
type: | ||
KaUsualClassType: | ||
annotations: [] | ||
typeArguments: [] | ||
type: Result.Failure | ||
isNegated: false | ||
] | ||
hasStableParameterNames: true | ||
isActual: false | ||
isBuiltinFunctionInvoke: false | ||
isExpect: false | ||
isExtension: false | ||
isExternal: false | ||
isInfix: false | ||
isInline: false | ||
isOperator: false | ||
isOverride: false | ||
isStatic: false | ||
isSuspend: false | ||
isTailRec: false | ||
location: CLASS | ||
modality: FINAL | ||
name: isFailure | ||
origin: SOURCE | ||
receiverParameter: null | ||
returnType: KaUsualClassType: | ||
annotations: [] | ||
typeArguments: [] | ||
type: kotlin/Boolean | ||
typeParameters: [] | ||
valueParameters: [] | ||
visibility: PUBLIC | ||
getDispatchReceiver(): KaUsualClassType: | ||
annotations: [] | ||
typeArguments: [] | ||
type: Result | ||
getContainingFileSymbol: KaFileSymbol(castForDispatchReceiver.kt) | ||
getContainingJvmClassName: Result | ||
canBeOperator: false | ||
getContainingModule: KaSourceModule "Sources of main" | ||
deprecationStatus: null |
17 changes: 17 additions & 0 deletions
17
...ysis/analysis-api/testData/symbols/singleSymbolByPsi/contracts/castForDispatchReceiver.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1 | ||
import kotlin.contracts.ExperimentalContracts | ||
import kotlin.contracts.contract | ||
|
||
sealed class Result { | ||
class Success : Result() | ||
class Failure : Result() | ||
|
||
@OptIn(ExperimentalContracts::class) | ||
fun isFail<caret>ure(): Boolean { | ||
contract { | ||
returns() implies (this@Result is Failure) | ||
} | ||
|
||
return this is Failure | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...lysis-api/testData/symbols/singleSymbolByPsi/contracts/castForDispatchReceiver.pretty.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@kotlin.OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class]) | ||
fun isFailure(): kotlin.Boolean |
45 changes: 45 additions & 0 deletions
45
...sis/analysis-api/testData/symbols/singleSymbolByPsi/contracts/castForDispatchReceiver.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
KaNamedFunctionSymbol: | ||
annotations: [ | ||
kotlin/OptIn(markerClass = [kotlin.contracts.ExperimentalContracts::class]) | ||
psi: KtAnnotationEntry | ||
] | ||
callableId: /Result.isFailure | ||
compilerVisibility: Public | ||
contextParameters: [] | ||
contextReceivers: [] | ||
contractEffects: Could not render due to org.jetbrains.kotlin.utils.exceptions.KotlinIllegalArgumentExceptionWithAttachments: class org.jetbrains.kotlin.analysis.api.fir.symbols.KaFirNamedFunctionSymbol should contain a receiver | ||
|
||
hasStableParameterNames: true | ||
isActual: false | ||
isBuiltinFunctionInvoke: false | ||
isExpect: false | ||
isExtension: false | ||
isExternal: false | ||
isInfix: false | ||
isInline: false | ||
isOperator: false | ||
isOverride: false | ||
isStatic: false | ||
isSuspend: false | ||
isTailRec: false | ||
location: CLASS | ||
modality: FINAL | ||
name: isFailure | ||
origin: SOURCE | ||
receiverParameter: null | ||
returnType: KaUsualClassType: | ||
annotations: [] | ||
typeArguments: [] | ||
type: kotlin/Boolean | ||
typeParameters: [] | ||
valueParameters: [] | ||
visibility: PUBLIC | ||
getDispatchReceiver(): KaUsualClassType: | ||
annotations: [] | ||
typeArguments: [] | ||
type: Result | ||
getContainingFileSymbol: KaFileSymbol(castForDispatchReceiver.kt) | ||
getContainingJvmClassName: Result | ||
canBeOperator: false | ||
getContainingModule: KaSourceModule "Sources of main" | ||
deprecationStatus: null |