From d8b88e9b692488ffbb0bccffe4b37ad6bb3e6a23 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 15 Jun 2022 17:27:10 +0200 Subject: [PATCH] [Analysis API] add testcases, add comments to tests --- .../innerClassTypeParamsSubstitution.kt | 6 +++- ...nnerClassTypeParamsSubstitution.pretty.txt | 2 ++ .../innerClassTypeParamsSubstitution.txt | 28 +++++++++++++++++++ .../signatureSubstitution/function.kt | 3 +- .../symbolSubstitution/function.kt | 2 ++ 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.kt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.kt index 6d296df37fb..e24d8a175fa 100644 --- a/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.kt +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.kt @@ -1,11 +1,15 @@ class Outer { - inner class A { + inner class A: Super { fun foo(x: X, y: Y): Map> val map: Map } } +abstract class Super { + abstract fun fromSuper(): S +} + fun foo(o: Outer) { val a = o.A() println(a) diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.pretty.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.pretty.txt index 2823c59576d..d39d9e2209a 100644 --- a/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.pretty.txt +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.pretty.txt @@ -1,6 +1,7 @@ KtTypeScope: fun foo(x: kotlin.Int, y: Y): kotlin.collections.Map> val map: kotlin.collections.Map +fun fromSuper(): kotlin.String fun equals(other: kotlin.Any?): kotlin.Boolean fun hashCode(): kotlin.Int fun toString(): kotlin.String @@ -9,6 +10,7 @@ fun toString(): kotlin.String Declaration Scope: fun foo(x: X, y: Y): kotlin.collections.Map> val map: kotlin.collections.Map +fun fromSuper(): O fun equals(other: kotlin.Any?): kotlin.Boolean fun hashCode(): kotlin.Int fun toString(): kotlin.String diff --git a/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.txt b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.txt index ca1fd63f0d8..9f51f342e28 100644 --- a/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.txt +++ b/analysis/analysis-api/testData/components/scopeProvider/typeScope/innerClassTypeParamsSubstitution.txt @@ -27,6 +27,12 @@ KtVariableLikeSignature: returnType = kotlin.collections.Map symbol = val map: kotlin.collections.Map callableIdIfNonLocal = /Outer.A.map +KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = /Outer.A.fromSuper(: Outer.A): O + valueParameters = [] + callableIdIfNonLocal = /Outer.A.fromSuper KtFunctionLikeSignature: receiverType = null returnType = kotlin.Boolean @@ -107,6 +113,28 @@ KtKotlinPropertySymbol: symbolKind: CLASS_MEMBER typeParameters: [] visibility: Public +KtFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: /Outer.A.fromSuper + hasStableParameterNames: true + isBuiltinFunctionInvoke: false + isExtension: false + isExternal: false + isInfix: false + isInline: false + isOperator: false + isOverride: false + isStatic: false + isSuspend: false + modality: ABSTRACT + name: fromSuper + origin: SOURCE + receiverType: null + returnType: O + symbolKind: CLASS_MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public KtFunctionSymbol: annotationsList: [] callableIdIfNonLocal: kotlin/Any.equals diff --git a/analysis/analysis-api/testData/components/signatureSubstitution/signatureSubstitution/function.kt b/analysis/analysis-api/testData/components/signatureSubstitution/signatureSubstitution/function.kt index 6b2c392db3c..386e4d0fa16 100644 --- a/analysis/analysis-api/testData/components/signatureSubstitution/signatureSubstitution/function.kt +++ b/analysis/analysis-api/testData/components/signatureSubstitution/signatureSubstitution/function.kt @@ -1,3 +1,4 @@ // SUBSTITUTOR: T -> kotlin.collections.List, S -> kotlin.Long +// the test checks that function own type parameters (`S` in this test) won't be substituted recursively -fun foo(x: List, y: Map>, k: String): T \ No newline at end of file +fun foo(x: List, y: Map>, k: String): T \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/signatureSubstitution/symbolSubstitution/function.kt b/analysis/analysis-api/testData/components/signatureSubstitution/symbolSubstitution/function.kt index 6b2c392db3c..18eb9c0dc28 100644 --- a/analysis/analysis-api/testData/components/signatureSubstitution/symbolSubstitution/function.kt +++ b/analysis/analysis-api/testData/components/signatureSubstitution/symbolSubstitution/function.kt @@ -1,3 +1,5 @@ +// the test checks that function own type parameters (`S` in this test) won't be substituted recursively + // SUBSTITUTOR: T -> kotlin.collections.List, S -> kotlin.Long fun foo(x: List, y: Map>, k: String): T \ No newline at end of file