[FIR] create error type ref for parameter when one is required instead of implicit type in RawFirBuilder
Needed to avoid failure during lazy resolving of corresponding declarations in the IDE ^KTIJ-22357 fixed
This commit is contained in:
+58
@@ -290,6 +290,64 @@ public class FirLazyBodiesCalculatorTestGenerated extends AbstractFirLazyBodiesC
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class NoParameterType {
|
||||
@Test
|
||||
public void testAllFilesPresentInNoParameterType() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInCatch.kt")
|
||||
public void testNoParameterTypRefInCatch() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInCatch.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInFuncionalType.kt")
|
||||
public void testNoParameterTypRefInFuncionalType() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFuncionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInFunction.kt")
|
||||
public void testNoParameterTypRefInFunction() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInLambda.kt")
|
||||
public void testNoParameterTypRefInLambda() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInPrimaryConstructor.kt")
|
||||
public void testNoParameterTypRefInPrimaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInPrimaryConsturctorVal.kt")
|
||||
public void testNoParameterTypRefInPrimaryConsturctorVal() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorVal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInSecondaryConstructor.kt")
|
||||
public void testNoParameterTypRefInSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInSetter.kt")
|
||||
public void testNoParameterTypRefInSetter() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSetter.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+11
-7
@@ -940,7 +940,7 @@ class DeclarationsConverter(
|
||||
secondaryConstructor.forEachChildren {
|
||||
when (it.tokenType) {
|
||||
MODIFIER_LIST -> modifiers = convertModifierList(it)
|
||||
VALUE_PARAMETER_LIST -> firValueParameters += convertValueParameters(it)
|
||||
VALUE_PARAMETER_LIST -> firValueParameters += convertValueParameters(it, ValueParameterDeclaration.FUNCTION)
|
||||
CONSTRUCTOR_DELEGATION_CALL -> constructorDelegationCall = convertConstructorDelegationCall(it, classWrapper)
|
||||
BLOCK -> block = it
|
||||
}
|
||||
@@ -1522,7 +1522,7 @@ class DeclarationsConverter(
|
||||
setterParameter.forEachChildren {
|
||||
when (it.tokenType) {
|
||||
MODIFIER_LIST -> modifiers = convertModifierList(it)
|
||||
VALUE_PARAMETER -> firValueParameter = convertValueParameter(it).firValueParameter
|
||||
VALUE_PARAMETER -> firValueParameter = convertValueParameter(it, ValueParameterDeclaration.SETTER).firValueParameter
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1650,7 +1650,7 @@ class DeclarationsConverter(
|
||||
valueParametersList?.let { list ->
|
||||
valueParameters += convertValueParameters(
|
||||
list,
|
||||
if (isAnonymousFunction) ValueParameterDeclaration.LAMBDA else ValueParameterDeclaration.OTHER
|
||||
if (isAnonymousFunction) ValueParameterDeclaration.LAMBDA else ValueParameterDeclaration.FUNCTION
|
||||
).map { it.firValueParameter }
|
||||
}
|
||||
|
||||
@@ -2149,7 +2149,7 @@ class DeclarationsConverter(
|
||||
functionType.forEachChildren {
|
||||
when (it.tokenType) {
|
||||
FUNCTION_TYPE_RECEIVER -> receiverTypeReference = convertReceiverType(it)
|
||||
VALUE_PARAMETER_LIST -> valueParametersList += convertValueParameters(it)
|
||||
VALUE_PARAMETER_LIST -> valueParametersList += convertValueParameters(it, ValueParameterDeclaration.FUNCTIONAL_TYPE)
|
||||
TYPE_REFERENCE -> returnTypeReference = convertType(it)
|
||||
}
|
||||
}
|
||||
@@ -2174,7 +2174,7 @@ class DeclarationsConverter(
|
||||
*/
|
||||
fun convertValueParameters(
|
||||
valueParameters: LighterASTNode,
|
||||
valueParameterDeclaration: ValueParameterDeclaration = ValueParameterDeclaration.OTHER,
|
||||
valueParameterDeclaration: ValueParameterDeclaration,
|
||||
additionalAnnotations: List<FirAnnotation> = emptyList()
|
||||
): List<ValueParameter> {
|
||||
return valueParameters.forEachChildrenReturnList { node, container ->
|
||||
@@ -2189,7 +2189,7 @@ class DeclarationsConverter(
|
||||
*/
|
||||
fun convertValueParameter(
|
||||
valueParameter: LighterASTNode,
|
||||
valueParameterDeclaration: ValueParameterDeclaration = ValueParameterDeclaration.OTHER,
|
||||
valueParameterDeclaration: ValueParameterDeclaration,
|
||||
additionalAnnotations: List<FirAnnotation> = emptyList()
|
||||
): ValueParameter {
|
||||
var modifiers = Modifier()
|
||||
@@ -2216,7 +2216,11 @@ class DeclarationsConverter(
|
||||
source = valueParameter.toFirSourceElement()
|
||||
moduleData = baseModuleData
|
||||
origin = FirDeclarationOrigin.Source
|
||||
returnTypeRef = firType ?: implicitType
|
||||
returnTypeRef = firType
|
||||
?: when {
|
||||
valueParameterDeclaration.shouldExplicitParameterTypeBePresent -> createNoTypeForParameterTypeRef()
|
||||
else -> implicitType
|
||||
}
|
||||
this.name = name
|
||||
symbol = FirValueParameterSymbol(name)
|
||||
defaultValue = firExpression
|
||||
|
||||
+1
-1
@@ -1059,7 +1059,7 @@ class ExpressionsConverter(
|
||||
var blockNode: LighterASTNode? = null
|
||||
forLoop.forEachChildren {
|
||||
when (it.tokenType) {
|
||||
VALUE_PARAMETER -> parameter = declarationsConverter.convertValueParameter(it)
|
||||
VALUE_PARAMETER -> parameter = declarationsConverter.convertValueParameter(it, ValueParameterDeclaration.FOR_LOOP)
|
||||
LOOP_RANGE -> rangeExpression = getAsFirExpression(it, "No range in for loop")
|
||||
BODY -> blockNode = it
|
||||
}
|
||||
|
||||
+53
@@ -269,6 +269,59 @@ public class LightTree2FirConverterTestCaseGenerated extends AbstractLightTree2F
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class NoParameterType extends AbstractLightTree2FirConverterTestCase {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInNoParameterType() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInCatch.kt")
|
||||
public void testNoParameterTypRefInCatch() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInCatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInFuncionalType.kt")
|
||||
public void testNoParameterTypRefInFuncionalType() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFuncionalType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInFunction.kt")
|
||||
public void testNoParameterTypRefInFunction() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInLambda.kt")
|
||||
public void testNoParameterTypRefInLambda() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInPrimaryConstructor.kt")
|
||||
public void testNoParameterTypRefInPrimaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInPrimaryConsturctorVal.kt")
|
||||
public void testNoParameterTypRefInPrimaryConsturctorVal() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorVal.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInSecondaryConstructor.kt")
|
||||
public void testNoParameterTypRefInSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInSetter.kt")
|
||||
public void testNoParameterTypRefInSetter() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSetter.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions")
|
||||
|
||||
@@ -179,7 +179,7 @@ open class RawFirBuilder(
|
||||
open fun convertValueParameter(
|
||||
valueParameter: KtParameter,
|
||||
defaultTypeRef: FirTypeRef? = null,
|
||||
valueParameterDeclaration: ValueParameterDeclaration = ValueParameterDeclaration.OTHER,
|
||||
valueParameterDeclaration: ValueParameterDeclaration,
|
||||
additionalAnnotations: List<FirAnnotation> = emptyList()
|
||||
): FirValueParameter = valueParameter.toFirValueParameter(defaultTypeRef, valueParameterDeclaration, additionalAnnotations)
|
||||
|
||||
@@ -406,7 +406,7 @@ open class RawFirBuilder(
|
||||
annotations += accessorAnnotationsFromProperty
|
||||
this@RawFirBuilder.context.firFunctionTargets += accessorTarget
|
||||
extractValueParametersTo(
|
||||
this, ValueParameterDeclaration.OTHER, propertyTypeRefToUse, parameterAnnotationsFromProperty
|
||||
this, ValueParameterDeclaration.SETTER, propertyTypeRefToUse, parameterAnnotationsFromProperty
|
||||
)
|
||||
if (!isGetter && valueParameters.isEmpty()) {
|
||||
valueParameters += buildDefaultSetterValueParameter {
|
||||
@@ -538,6 +538,7 @@ open class RawFirBuilder(
|
||||
returnTypeRef = when {
|
||||
typeReference != null -> typeReference.toFirOrErrorType()
|
||||
defaultTypeRef != null -> defaultTypeRef
|
||||
valueParameterDeclaration.shouldExplicitParameterTypeBePresent -> createNoTypeForParameterTypeRef()
|
||||
else -> null.toFirOrImplicitType()
|
||||
}
|
||||
this.name = name
|
||||
@@ -568,7 +569,7 @@ open class RawFirBuilder(
|
||||
|
||||
private fun KtParameter.toFirProperty(firParameter: FirValueParameter): FirProperty {
|
||||
require(hasValOrVar())
|
||||
val type = typeReference.toFirOrErrorType()
|
||||
val type = typeReference.convertSafe<FirTypeRef>() ?: createNoTypeForParameterTypeRef()
|
||||
val status = FirDeclarationStatusImpl(visibility, modality).apply {
|
||||
isExpect = hasExpectModifier() || this@RawFirBuilder.context.containerIsExpect
|
||||
isActual = hasActualModifier()
|
||||
@@ -1310,7 +1311,7 @@ open class RawFirBuilder(
|
||||
valueParameters += convertValueParameter(
|
||||
valueParameter,
|
||||
null,
|
||||
if (isAnonymousFunction) ValueParameterDeclaration.LAMBDA else ValueParameterDeclaration.OTHER
|
||||
if (isAnonymousFunction) ValueParameterDeclaration.LAMBDA else ValueParameterDeclaration.FUNCTION
|
||||
)
|
||||
}
|
||||
val actualTypeParameters = if (this is FirSimpleFunctionBuilder)
|
||||
@@ -1485,7 +1486,7 @@ open class RawFirBuilder(
|
||||
this@RawFirBuilder.context.firFunctionTargets += target
|
||||
extractAnnotationsTo(this)
|
||||
typeParameters += constructorTypeParametersFromConstructedClass(ownerTypeParameters)
|
||||
extractValueParametersTo(this, ValueParameterDeclaration.OTHER)
|
||||
extractValueParametersTo(this, ValueParameterDeclaration.FUNCTION)
|
||||
|
||||
|
||||
val (body, _) = buildFirBody()
|
||||
@@ -1774,7 +1775,7 @@ open class RawFirBuilder(
|
||||
// TODO: probably implicit type should not be here
|
||||
returnTypeRef = unwrappedElement.returnTypeReference.toFirOrErrorType()
|
||||
for (valueParameter in unwrappedElement.parameters) {
|
||||
valueParameters += valueParameter.convert<FirValueParameter>()
|
||||
valueParameters += convertValueParameter(valueParameter, valueParameterDeclaration = ValueParameterDeclaration.FUNCTIONAL_TYPE)
|
||||
}
|
||||
|
||||
contextReceiverTypeRefs.addAll(
|
||||
@@ -1848,9 +1849,6 @@ open class RawFirBuilder(
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitParameter(parameter: KtParameter, data: Unit): FirElement =
|
||||
convertValueParameter(parameter)
|
||||
|
||||
override fun visitBlockExpression(expression: KtBlockExpression, data: Unit): FirElement {
|
||||
return configureBlockWithoutBuilding(expression).build()
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun foo() {
|
||||
try {
|
||||
|
||||
} catch(e) {}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
FILE: noParameterTypRefInCatch.kt
|
||||
public? final? fun foo(): R|kotlin/Unit| {
|
||||
try {
|
||||
}
|
||||
catch (e: <ERROR TYPE REF: No type for parameter>) {
|
||||
}
|
||||
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun x(p: (a) -> Int) {
|
||||
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
FILE: noParameterTypRefInFuncionalType.kt
|
||||
public? final? fun x(p: ( (a) -> Int )): R|kotlin/Unit| {
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun foo(x) {}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
FILE: noParameterTypRefInFunction.kt
|
||||
public? final? fun foo(x: <ERROR TYPE REF: No type for parameter>): R|kotlin/Unit| {
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun foo() {
|
||||
1.let { i -> i }
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
FILE: noParameterTypRefInLambda.kt
|
||||
public? final? fun foo(): R|kotlin/Unit| {
|
||||
IntegerLiteral(1).let#(<L> = let@fun <implicit>.<anonymous>(i: <implicit>): <implicit> <inline=Unknown> {
|
||||
i#
|
||||
}
|
||||
)
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
class X(x) {}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
FILE: noParameterTypRefInPrimaryConstructor.kt
|
||||
public? final? class X : R|kotlin/Any| {
|
||||
public? [ContainingClassKey=X] constructor(x: <ERROR TYPE REF: No type for parameter>): R|X| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
class X(val x) {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
FILE: noParameterTypRefInPrimaryConsturctorVal.kt
|
||||
public? final? class X : R|kotlin/Any| {
|
||||
public? [ContainingClassKey=X] constructor([CorrespondingProperty=/X.x] x: <ERROR TYPE REF: No type for parameter>): R|X| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public? final? [IsFromPrimaryConstructor=true] val x: <ERROR TYPE REF: No type for parameter> = R|<local>/x|
|
||||
public? [ContainingClassKey=X] get(): <ERROR TYPE REF: No type for parameter>
|
||||
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
constructor(x) {}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
FILE: noParameterTypRefInSecondaryConstructor.kt
|
||||
public? final? class C : R|kotlin/Any| {
|
||||
public? [ContainingClassKey=C] constructor(x: <ERROR TYPE REF: No type for parameter>): R|C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
var x: Int
|
||||
set(value){}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
FILE: noParameterTypRefInSetter.kt
|
||||
public? final? var x: Int
|
||||
public? get(): Int
|
||||
public? set(value: Int): R|kotlin/Unit| {
|
||||
}
|
||||
+53
@@ -269,6 +269,59 @@ public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class NoParameterType extends AbstractRawFirBuilderLazyBodiesTestCase {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInNoParameterType() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInCatch.kt")
|
||||
public void testNoParameterTypRefInCatch() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInCatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInFuncionalType.kt")
|
||||
public void testNoParameterTypRefInFuncionalType() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFuncionalType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInFunction.kt")
|
||||
public void testNoParameterTypRefInFunction() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInLambda.kt")
|
||||
public void testNoParameterTypRefInLambda() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInPrimaryConstructor.kt")
|
||||
public void testNoParameterTypRefInPrimaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInPrimaryConsturctorVal.kt")
|
||||
public void testNoParameterTypRefInPrimaryConsturctorVal() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorVal.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInSecondaryConstructor.kt")
|
||||
public void testNoParameterTypRefInSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInSetter.kt")
|
||||
public void testNoParameterTypRefInSetter() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSetter.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions")
|
||||
|
||||
+53
@@ -269,6 +269,59 @@ public class RawFirBuilderTestCaseGenerated extends AbstractRawFirBuilderTestCas
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class NoParameterType extends AbstractRawFirBuilderTestCase {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doRawFirTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInNoParameterType() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInCatch.kt")
|
||||
public void testNoParameterTypRefInCatch() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInCatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInFuncionalType.kt")
|
||||
public void testNoParameterTypRefInFuncionalType() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFuncionalType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInFunction.kt")
|
||||
public void testNoParameterTypRefInFunction() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInLambda.kt")
|
||||
public void testNoParameterTypRefInLambda() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInPrimaryConstructor.kt")
|
||||
public void testNoParameterTypRefInPrimaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInPrimaryConsturctorVal.kt")
|
||||
public void testNoParameterTypRefInPrimaryConsturctorVal() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorVal.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInSecondaryConstructor.kt")
|
||||
public void testNoParameterTypRefInSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterTypRefInSetter.kt")
|
||||
public void testNoParameterTypRefInSetter() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSetter.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions")
|
||||
|
||||
+16
-6
@@ -28,8 +28,10 @@ import org.jetbrains.kotlin.fir.references.builder.*
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirSimpleNamedReference
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
import org.jetbrains.kotlin.fir.types.FirErrorTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
||||
@@ -39,7 +41,6 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.parsing.*
|
||||
import org.jetbrains.kotlin.psi.KtObjectDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtPsiUtil
|
||||
import org.jetbrains.kotlin.types.ConstantValueKind
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
@@ -1281,10 +1282,19 @@ abstract class BaseFirBuilder<T>(val baseSession: FirSession, val context: Conte
|
||||
symbol = FirErrorPropertySymbol(diagnostic)
|
||||
}
|
||||
|
||||
enum class ValueParameterDeclaration {
|
||||
OTHER,
|
||||
LAMBDA,
|
||||
CATCH,
|
||||
PRIMARY_CONSTRUCTOR,
|
||||
protected fun createNoTypeForParameterTypeRef(): FirErrorTypeRef {
|
||||
return buildErrorTypeRef {
|
||||
diagnostic = ConeSimpleDiagnostic("No type for parameter", DiagnosticKind.ValueParameterWithNoTypeAnnotation)
|
||||
}
|
||||
}
|
||||
|
||||
enum class ValueParameterDeclaration(val shouldExplicitParameterTypeBePresent: Boolean) {
|
||||
FUNCTION(shouldExplicitParameterTypeBePresent = true),
|
||||
CATCH(shouldExplicitParameterTypeBePresent = true),
|
||||
PRIMARY_CONSTRUCTOR(shouldExplicitParameterTypeBePresent = true),
|
||||
FUNCTIONAL_TYPE(shouldExplicitParameterTypeBePresent = true),
|
||||
SETTER(shouldExplicitParameterTypeBePresent = false),
|
||||
LAMBDA(shouldExplicitParameterTypeBePresent = false),
|
||||
FOR_LOOP(shouldExplicitParameterTypeBePresent = false),
|
||||
}
|
||||
}
|
||||
|
||||
+58
@@ -290,6 +290,64 @@ public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizerTe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class NoParameterType {
|
||||
@Test
|
||||
public void testAllFilesPresentInNoParameterType() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInCatch.kt")
|
||||
public void testNoParameterTypRefInCatch() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInCatch.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInFuncionalType.kt")
|
||||
public void testNoParameterTypRefInFuncionalType() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFuncionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInFunction.kt")
|
||||
public void testNoParameterTypRefInFunction() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInLambda.kt")
|
||||
public void testNoParameterTypRefInLambda() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInPrimaryConstructor.kt")
|
||||
public void testNoParameterTypRefInPrimaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInPrimaryConsturctorVal.kt")
|
||||
public void testNoParameterTypRefInPrimaryConsturctorVal() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorVal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInSecondaryConstructor.kt")
|
||||
public void testNoParameterTypRefInSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInSetter.kt")
|
||||
public void testNoParameterTypRefInSetter() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSetter.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+58
@@ -290,6 +290,64 @@ public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizerTe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class NoParameterType {
|
||||
@Test
|
||||
public void testAllFilesPresentInNoParameterType() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInCatch.kt")
|
||||
public void testNoParameterTypRefInCatch() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInCatch.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInFuncionalType.kt")
|
||||
public void testNoParameterTypRefInFuncionalType() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFuncionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInFunction.kt")
|
||||
public void testNoParameterTypRefInFunction() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInLambda.kt")
|
||||
public void testNoParameterTypRefInLambda() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInPrimaryConstructor.kt")
|
||||
public void testNoParameterTypRefInPrimaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInPrimaryConsturctorVal.kt")
|
||||
public void testNoParameterTypRefInPrimaryConsturctorVal() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorVal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInSecondaryConstructor.kt")
|
||||
public void testNoParameterTypRefInSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noParameterTypRefInSetter.kt")
|
||||
public void testNoParameterTypRefInSetter() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSetter.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
Reference in New Issue
Block a user