[FIR] Reproduce KT-65584
The diagnostic target source element type was changed to prevent crash due to `checkPsiTypeConsistency()` in `duplicateParameterNameSimplified.fir.kt` ^KT-65584
This commit is contained in:
committed by
Space Team
parent
ef29879740
commit
8ec248131d
+1
-1
@@ -333,7 +333,7 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
val reference: String
|
||||
}
|
||||
|
||||
interface DuplicateParameterNameInFunctionType : KtFirDiagnostic<KtTypeReference> {
|
||||
interface DuplicateParameterNameInFunctionType : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = DuplicateParameterNameInFunctionType::class
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -386,7 +386,7 @@ internal class UnresolvedImportImpl(
|
||||
internal class DuplicateParameterNameInFunctionTypeImpl(
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<KtTypeReference>(firDiagnostic, token), KtFirDiagnostic.DuplicateParameterNameInFunctionType
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.DuplicateParameterNameInFunctionType
|
||||
|
||||
internal class MissingDependencyClassImpl(
|
||||
override val type: KtType,
|
||||
|
||||
+12
@@ -357,6 +357,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateDirrectOverriddenCallables.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("duplicateParameterName.kt")
|
||||
public void testDuplicateParameterName() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateParameterName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("duplicateParameterNameSimplified.kt")
|
||||
public void testDuplicateParameterNameSimplified() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateParameterNameSimplified.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyLhsClassLiterals.kt")
|
||||
public void testEmptyLhsClassLiterals() throws Exception {
|
||||
|
||||
+12
@@ -357,6 +357,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateDirrectOverriddenCallables.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("duplicateParameterName.kt")
|
||||
public void testDuplicateParameterName() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateParameterName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("duplicateParameterNameSimplified.kt")
|
||||
public void testDuplicateParameterNameSimplified() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateParameterNameSimplified.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyLhsClassLiterals.kt")
|
||||
public void testEmptyLhsClassLiterals() throws Exception {
|
||||
|
||||
+12
@@ -357,6 +357,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateDirrectOverriddenCallables.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("duplicateParameterName.kt")
|
||||
public void testDuplicateParameterName() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateParameterName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("duplicateParameterNameSimplified.kt")
|
||||
public void testDuplicateParameterNameSimplified() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateParameterNameSimplified.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyLhsClassLiterals.kt")
|
||||
public void testEmptyLhsClassLiterals() throws Exception {
|
||||
|
||||
+12
@@ -357,6 +357,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateDirrectOverriddenCallables.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("duplicateParameterName.kt")
|
||||
public void testDuplicateParameterName() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateParameterName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("duplicateParameterNameSimplified.kt")
|
||||
public void testDuplicateParameterNameSimplified() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateParameterNameSimplified.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyLhsClassLiterals.kt")
|
||||
public void testEmptyLhsClassLiterals() throws Exception {
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") {
|
||||
parameter<String>("reference")
|
||||
}
|
||||
|
||||
val DUPLICATE_PARAMETER_NAME_IN_FUNCTION_TYPE by error<KtTypeReference>()
|
||||
val DUPLICATE_PARAMETER_NAME_IN_FUNCTION_TYPE by error<PsiElement>()
|
||||
|
||||
val MISSING_DEPENDENCY_CLASS by error<PsiElement>(PositioningStrategy.REFERENCED_NAME_BY_QUALIFIED) {
|
||||
parameter<ConeKotlinType>("type")
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ object FirErrors {
|
||||
val API_NOT_AVAILABLE: KtDiagnosticFactory2<ApiVersion, ApiVersion> by error2<PsiElement, ApiVersion, ApiVersion>(SourceElementPositioningStrategies.SELECTOR_BY_QUALIFIED)
|
||||
val UNRESOLVED_REFERENCE_WRONG_RECEIVER: KtDiagnosticFactory1<Collection<FirBasedSymbol<*>>> by error1<PsiElement, Collection<FirBasedSymbol<*>>>(SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED)
|
||||
val UNRESOLVED_IMPORT: KtDiagnosticFactory1<String> by error1<PsiElement, String>(SourceElementPositioningStrategies.IMPORT_LAST_NAME)
|
||||
val DUPLICATE_PARAMETER_NAME_IN_FUNCTION_TYPE: KtDiagnosticFactory0 by error0<KtTypeReference>()
|
||||
val DUPLICATE_PARAMETER_NAME_IN_FUNCTION_TYPE: KtDiagnosticFactory0 by error0<PsiElement>()
|
||||
val MISSING_DEPENDENCY_CLASS: KtDiagnosticFactory1<ConeKotlinType> by error1<PsiElement, ConeKotlinType>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED)
|
||||
val MISSING_DEPENDENCY_SUPERCLASS: KtDiagnosticFactory2<ConeKotlinType, ConeKotlinType> by error2<PsiElement, ConeKotlinType, ConeKotlinType>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED)
|
||||
val MISSING_DEPENDENCY_CLASS_IN_LAMBDA_PARAMETER: KtDiagnosticFactory1<ConeKotlinType> by warning1<PsiElement, ConeKotlinType>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// ISSUE: KT-65584
|
||||
// WITH_STDLIB
|
||||
|
||||
fun interface Flow<out T> {
|
||||
|
||||
suspend fun collect(collector: FlowCollector<T>)
|
||||
}
|
||||
|
||||
fun interface FlowCollector<in T> {
|
||||
|
||||
suspend fun emit(value: T)
|
||||
}
|
||||
|
||||
inline fun <T, R> Flow<T>.flatMapLatest(crossinline transform: suspend (value: T) -> Flow<R>) = Flow { collector ->
|
||||
collect { it1 -> transform(it1).collect { it2 -> collector.emit(it2) } }
|
||||
}
|
||||
|
||||
fun <T> flowOf(value: T): Flow<T> = Flow { collector -> collector.emit(value) }
|
||||
|
||||
inline fun <T, R> Flow<T>.map(crossinline transform: suspend (value: T) -> R): Flow<R> = Flow { collector ->
|
||||
collect { collector.emit(transform(it)) }
|
||||
}
|
||||
|
||||
// ------
|
||||
|
||||
class StationId
|
||||
class Playable
|
||||
class Entity(val stationId: StationId)
|
||||
class State(val playbackEntity: Entity)
|
||||
|
||||
internal suspend fun init(
|
||||
queueState: State,
|
||||
state: Flow<Playable>
|
||||
) {
|
||||
state
|
||||
.flatMapLatest { playable ->
|
||||
flowOf(playable).map { Triple(it, playable, queueState.playbackEntity.stationId) }
|
||||
}
|
||||
.collect { <!DUPLICATE_PARAMETER_NAME_IN_FUNCTION_TYPE!>(likeState, playable, stationId)<!> ->
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// ISSUE: KT-65584
|
||||
// WITH_STDLIB
|
||||
|
||||
fun interface Flow<out T> {
|
||||
|
||||
suspend fun collect(collector: FlowCollector<T>)
|
||||
}
|
||||
|
||||
fun interface FlowCollector<in T> {
|
||||
|
||||
suspend fun emit(value: T)
|
||||
}
|
||||
|
||||
inline fun <T, R> Flow<T>.flatMapLatest(crossinline transform: suspend (value: T) -> Flow<R>) = Flow { collector ->
|
||||
collect { it1 -> transform(it1).collect { it2 -> collector.emit(it2) } }
|
||||
}
|
||||
|
||||
fun <T> flowOf(value: T): Flow<T> = Flow { collector -> collector.emit(value) }
|
||||
|
||||
inline fun <T, R> Flow<T>.map(crossinline transform: suspend (value: T) -> R): Flow<R> = Flow { collector ->
|
||||
collect { collector.emit(transform(it)) }
|
||||
}
|
||||
|
||||
// ------
|
||||
|
||||
class StationId
|
||||
class Playable
|
||||
class Entity(val stationId: StationId)
|
||||
class State(val playbackEntity: Entity)
|
||||
|
||||
internal suspend fun init(
|
||||
queueState: State,
|
||||
state: Flow<Playable>
|
||||
) {
|
||||
state
|
||||
.flatMapLatest { playable ->
|
||||
flowOf(playable).map { Triple(it, playable, queueState.playbackEntity.stationId) }
|
||||
}
|
||||
.collect { (likeState, playable, stationId) ->
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-65584
|
||||
|
||||
fun <T> giveItName(it: T, block: (myName: T) -> Unit) = block(it)
|
||||
|
||||
fun <T> duplicateIt(it: T, block: (T, T) -> Unit) = block
|
||||
|
||||
class MyTriple<T, K, M>(val a: T, val b: K, val c: M)
|
||||
|
||||
fun test() {
|
||||
giveItName(10) {
|
||||
MyTriple(it, it, it).also { <!DUPLICATE_PARAMETER_NAME_IN_FUNCTION_TYPE!>self<!> -> }
|
||||
(duplicateIt(it) { a, b -> }).also { <!DUPLICATE_PARAMETER_NAME_IN_FUNCTION_TYPE!>function<!> -> }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-65584
|
||||
|
||||
fun <T> giveItName(it: T, block: (myName: T) -> Unit) = block(it)
|
||||
|
||||
fun <T> duplicateIt(it: T, block: (T, T) -> Unit) = block
|
||||
|
||||
class MyTriple<T, K, M>(val a: T, val b: K, val c: M)
|
||||
|
||||
fun test() {
|
||||
giveItName(10) {
|
||||
MyTriple(it, it, it).also { self -> }
|
||||
(duplicateIt(it) { a, b -> }).also { function -> }
|
||||
}
|
||||
}
|
||||
Generated
+12
@@ -357,6 +357,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateDirrectOverriddenCallables.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("duplicateParameterName.kt")
|
||||
public void testDuplicateParameterName() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateParameterName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("duplicateParameterNameSimplified.kt")
|
||||
public void testDuplicateParameterNameSimplified() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/duplicateParameterNameSimplified.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyLhsClassLiterals.kt")
|
||||
public void testEmptyLhsClassLiterals() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user