[FIR] Move FirUnusedExpressionChecker to the default checkers list
^KT-77726 Fixed
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/unusedAnonymLambdaParam.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/unusedAnonymLambdaParam.kt
index e8960a5..b98ae50 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/unusedAnonymLambdaParam.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/unusedAnonymLambdaParam.kt
@@ -1,4 +1,5 @@
// RUN_PIPELINE_TILL: BACKEND
+// DIAGNOSTICS: +UNUSED_ANONYMOUS_PARAMETER
// WITH_EXTRA_CHECKERS
fun foo(a: (Int) -> Unit) {}
diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt
index 933c496..e4bee01 100644
--- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt
+++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt
@@ -10,6 +10,7 @@
import org.jetbrains.kotlin.fir.analysis.cfa.FirPropertyInitializationAnalyzer
import org.jetbrains.kotlin.fir.analysis.checkers.cfa.FirControlFlowChecker
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.*
+import org.jetbrains.kotlin.fir.analysis.checkers.extra.FirUnusedExpressionChecker
import org.jetbrains.kotlin.fir.analysis.checkers.syntax.*
object CommonDeclarationCheckers : DeclarationCheckers() {
@@ -34,6 +35,7 @@
FirOptionalExpectationDeclarationChecker,
FirMissingDependencySupertypeInDeclarationsChecker,
FirContextParametersDeclarationChecker,
+ FirUnusedExpressionChecker,
FirUnusedReturnValueChecker,
FirReturnValueAnnotationsChecker,
)
diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ExtraDeclarationCheckers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ExtraDeclarationCheckers.kt
index 5aa8590..b5e8cd5 100644
--- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ExtraDeclarationCheckers.kt
+++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ExtraDeclarationCheckers.kt
@@ -22,7 +22,6 @@
override val basicDeclarationCheckers: Set<FirBasicDeclarationChecker> = setOf(
RedundantVisibilityModifierSyntaxChecker,
RedundantModalityModifierSyntaxChecker,
- FirUnusedExpressionChecker,
)
override val propertyCheckers: Set<FirPropertyChecker> = setOf(
diff --git a/compiler/testData/cli/metadata/lambdaWithReceiver.out b/compiler/testData/cli/metadata/lambdaWithReceiver.out
index d86bac9..1905b1d 100644
--- a/compiler/testData/cli/metadata/lambdaWithReceiver.out
+++ b/compiler/testData/cli/metadata/lambdaWithReceiver.out
@@ -1 +1,4 @@
+compiler/testData/cli/metadata/lambdaWithReceiver.kt:2:18: warning: expression is unused.
+ "OK".apply { this }
+ ^^^^
OK
diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/internalFromFriendModuleCommon/source.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/internalFromFriendModuleCommon/source.kt
index 5e87288..e5a18d2 100644
--- a/compiler/testData/compileKotlinAgainstCustomBinaries/internalFromFriendModuleCommon/source.kt
+++ b/compiler/testData/compileKotlinAgainstCustomBinaries/internalFromFriendModuleCommon/source.kt
@@ -1,5 +1,6 @@
import a.*
+@Suppress("UNUSED_EXPRESSION")
private fun test(i: InternalInterface): InternalTypealias {
PublicClass().internalMemberFun()
PublicClass.Companion
diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/internalFromFriendModuleJs/source.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/internalFromFriendModuleJs/source.kt
index 5e87288..e5a18d2 100644
--- a/compiler/testData/compileKotlinAgainstCustomBinaries/internalFromFriendModuleJs/source.kt
+++ b/compiler/testData/compileKotlinAgainstCustomBinaries/internalFromFriendModuleJs/source.kt
@@ -1,5 +1,6 @@
import a.*
+@Suppress("UNUSED_EXPRESSION")
private fun test(i: InternalInterface): InternalTypealias {
PublicClass().internalMemberFun()
PublicClass.Companion
diff --git a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionError.diag.txt b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionError.diag.txt
index 4fe67f9..956833a 100644
--- a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionError.diag.txt
+++ b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionError.diag.txt
@@ -48,6 +48,8 @@
/privateTypesInsideInternalInlineFunctionError.kt:67:13: warning: 'private-in-file' type 'A.Nested' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
+/privateTypesInsideInternalInlineFunctionError.kt:68:5: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionError.kt:68:5: warning: 'private-in-file' type 'A' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
/privateTypesInsideInternalInlineFunctionError.kt:68:5: error: Public-API inline function accesses a non Public-API class
@@ -88,18 +90,26 @@
/privateTypesInsideInternalInlineFunctionError.kt:83:21: warning: 'private-in-file' type 'A.Nested' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
+/privateTypesInsideInternalInlineFunctionError.kt:84:13: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionError.kt:84:13: warning: 'private-in-file' type 'A' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
/privateTypesInsideInternalInlineFunctionError.kt:84:13: error: Public-API inline function accesses a non Public-API class
/privateTypesInsideInternalInlineFunctionError.kt:97:9: error: Local classes are not yet supported in inline functions.
+/privateTypesInsideInternalInlineFunctionError.kt:101:9: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionError.kt:116:17: error: Local classes are not yet supported in inline functions.
+/privateTypesInsideInternalInlineFunctionError.kt:120:17: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionError.kt:145:13: error: Local classes are not yet supported in inline functions.
/privateTypesInsideInternalInlineFunctionError.kt:145:27: error: Non-private inline function 'fun foo(): Unit' cannot access members of private class 'constructor<T>(): Generic<T>'.
/privateTypesInsideInternalInlineFunctionError.kt:146:22: error: Non-private inline function 'fun foo(): Unit' cannot access members of private class 'constructor<T>(): Generic<T>'.
+/privateTypesInsideInternalInlineFunctionError.kt:149:13: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionError.kt:158:16: warning: 'private-in-class' type 'PrivateOuter.PrivateNested?' is accessed from 'private-in-file' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
diff --git a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionError.kt b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionError.kt
index 2f744da..e477a10 100644
--- a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionError.kt
+++ b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionError.kt
@@ -65,7 +65,7 @@
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>withContext<!>.toString()
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!><!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A.Nested<!><!>
- <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
+ <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR, UNUSED_EXPRESSION!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
}
internal inline fun referencePrivateInsideAnonymousObject() {
@@ -81,7 +81,7 @@
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>class Local : <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING, PRIVATE_CLASS_MEMBER_FROM_INLINE!>Generic<<!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>><!>() {}<!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!><!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A.Nested<!><!>
- <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
+ <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR, UNUSED_EXPRESSION!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
}
}
}
@@ -98,7 +98,7 @@
object : Generic<A>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}
@@ -117,7 +117,7 @@
object : Generic<A>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}
}
@@ -146,7 +146,7 @@
object : <!PRIVATE_CLASS_MEMBER_FROM_INLINE!>Generic<A><!>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}.foo()
}
diff --git a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.diag.txt b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.diag.txt
index cb06944..d3d73f1 100644
--- a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.diag.txt
+++ b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.diag.txt
@@ -71,6 +71,8 @@
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:67:13: warning: 'private-in-file' type 'A.Nested' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
+/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:68:5: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:68:5: warning: 'private-in-file' type 'A' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:68:5: error: Public-API inline function accesses a non Public-API class
@@ -116,18 +118,26 @@
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:83:21: warning: 'private-in-file' type 'A.Nested' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
+/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:84:13: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:84:13: warning: 'private-in-file' type 'A' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:84:13: error: Public-API inline function accesses a non Public-API class
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:97:9: error: Local classes are not yet supported in inline functions.
+/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:101:9: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:116:17: error: Local classes are not yet supported in inline functions.
+/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:120:17: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:145:13: error: Local classes are not yet supported in inline functions.
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:145:27: error: Non-private inline function 'fun foo(): Unit' cannot access members of private class 'constructor<T>(): Generic<T>'.
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:146:22: error: Non-private inline function 'fun foo(): Unit' cannot access members of private class 'constructor<T>(): Generic<T>'.
+/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:149:13: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt:158:16: warning: 'private-in-class' type 'PrivateOuter.PrivateNested?' is accessed from 'private-in-file' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
diff --git a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt
index febd5df..931ab89 100644
--- a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt
+++ b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionErrorWithInlinedFunInKlib.kt
@@ -65,7 +65,7 @@
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>withContext<!>.toString()
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!><!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A.Nested<!><!>
- <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
+ <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR, UNUSED_EXPRESSION!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
}
internal inline fun referencePrivateInsideAnonymousObject() {
@@ -81,7 +81,7 @@
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>class Local : <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING, PRIVATE_CLASS_MEMBER_FROM_INLINE!>Generic<<!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>><!>() {}<!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!><!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A.Nested<!><!>
- <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
+ <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_ERROR, UNUSED_EXPRESSION!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
}
}
}
@@ -98,7 +98,7 @@
object : Generic<A>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}
@@ -117,7 +117,7 @@
object : Generic<A>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}
}
@@ -146,7 +146,7 @@
object : <!PRIVATE_CLASS_MEMBER_FROM_INLINE!>Generic<A><!>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}.foo()
}
diff --git a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarning.diag.txt b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarning.diag.txt
index b73189d..823c945 100644
--- a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarning.diag.txt
+++ b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarning.diag.txt
@@ -48,6 +48,8 @@
/privateTypesInsideInternalInlineFunctionWarning.kt:67:13: warning: 'private-in-file' type 'A.Nested' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
+/privateTypesInsideInternalInlineFunctionWarning.kt:68:5: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionWarning.kt:68:5: warning: 'private-in-file' type 'A' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
/privateTypesInsideInternalInlineFunctionWarning.kt:68:5: warning: Public-API inline function accesses a non Public-API class. This will become an error in language version 2.2. See https://youtrack.jetbrains.com/issue/KT-70916.
@@ -88,18 +90,26 @@
/privateTypesInsideInternalInlineFunctionWarning.kt:83:21: warning: 'private-in-file' type 'A.Nested' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
+/privateTypesInsideInternalInlineFunctionWarning.kt:84:13: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionWarning.kt:84:13: warning: 'private-in-file' type 'A' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
/privateTypesInsideInternalInlineFunctionWarning.kt:84:13: warning: Public-API inline function accesses a non Public-API class. This will become an error in language version 2.2. See https://youtrack.jetbrains.com/issue/KT-70916.
/privateTypesInsideInternalInlineFunctionWarning.kt:97:9: error: Local classes are not yet supported in inline functions.
+/privateTypesInsideInternalInlineFunctionWarning.kt:101:9: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionWarning.kt:116:17: error: Local classes are not yet supported in inline functions.
+/privateTypesInsideInternalInlineFunctionWarning.kt:120:17: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionWarning.kt:145:13: error: Local classes are not yet supported in inline functions.
/privateTypesInsideInternalInlineFunctionWarning.kt:145:27: error: Non-private inline function 'fun foo(): Unit' cannot access members of private class 'constructor<T>(): Generic<T>'.
/privateTypesInsideInternalInlineFunctionWarning.kt:146:22: error: Non-private inline function 'fun foo(): Unit' cannot access members of private class 'constructor<T>(): Generic<T>'.
+/privateTypesInsideInternalInlineFunctionWarning.kt:149:13: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionWarning.kt:158:16: warning: 'private-in-class' type 'PrivateOuter.PrivateNested?' is accessed from 'private-in-file' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
diff --git a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarning.kt b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarning.kt
index 24db4cb..22dad18 100644
--- a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarning.kt
+++ b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarning.kt
@@ -65,7 +65,7 @@
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>withContext<!>.toString()
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!><!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A.Nested<!><!>
- <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
+ <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING, UNUSED_EXPRESSION!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
}
internal inline fun referencePrivateInsideAnonymousObject() {
@@ -81,7 +81,7 @@
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>class Local : <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING, PRIVATE_CLASS_MEMBER_FROM_INLINE!>Generic<<!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>><!>() {}<!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!><!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A.Nested<!><!>
- <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
+ <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING, UNUSED_EXPRESSION!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
}
}
}
@@ -98,7 +98,7 @@
object : Generic<A>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}
@@ -117,7 +117,7 @@
object : Generic<A>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}
}
@@ -146,7 +146,7 @@
object : <!PRIVATE_CLASS_MEMBER_FROM_INLINE!>Generic<A><!>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}.foo()
}
diff --git a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.diag.txt b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.diag.txt
index 3e1e616..86a4fd6e1 100644
--- a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.diag.txt
+++ b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.diag.txt
@@ -71,6 +71,8 @@
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:67:13: warning: 'private-in-file' type 'A.Nested' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
+/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:68:5: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:68:5: warning: 'private-in-file' type 'A' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:68:5: warning: Public-API inline function accesses a non Public-API class. This will become an error in language version 2.2. See https://youtrack.jetbrains.com/issue/KT-70916.
@@ -116,18 +118,26 @@
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:83:21: warning: 'private-in-file' type 'A.Nested' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
+/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:84:13: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:84:13: warning: 'private-in-file' type 'A' is accessed from 'internal' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:84:13: warning: Public-API inline function accesses a non Public-API class. This will become an error in language version 2.2. See https://youtrack.jetbrains.com/issue/KT-70916.
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:97:9: error: Local classes are not yet supported in inline functions.
+/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:101:9: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:116:17: error: Local classes are not yet supported in inline functions.
+/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:120:17: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:145:13: error: Local classes are not yet supported in inline functions.
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:145:27: error: Non-private inline function 'fun foo(): Unit' cannot access members of private class 'constructor<T>(): Generic<T>'.
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:146:22: error: Non-private inline function 'fun foo(): Unit' cannot access members of private class 'constructor<T>(): Generic<T>'.
+/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:149:13: warning: Expression is unused.
+
/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt:158:16: warning: 'private-in-class' type 'PrivateOuter.PrivateNested?' is accessed from 'private-in-file' inline declaration. This will become an error in language version 2.4. See https://youtrack.jetbrains.com/issue/KTLC-283.
diff --git a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt
index 5f0a17f..c90f735 100644
--- a/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt
+++ b/compiler/testData/diagnostics/klibSerializationTests/privateTypeUsageInsideNonPrivateInlineFunction/privateTypesInsideInternalInlineFunctionWarningWithInlinedFunInKlib.kt
@@ -65,7 +65,7 @@
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>withContext<!>.toString()
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!><!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A.Nested<!><!>
- <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
+ <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING, UNUSED_EXPRESSION!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
}
internal inline fun referencePrivateInsideAnonymousObject() {
@@ -81,7 +81,7 @@
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>class Local : <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING, PRIVATE_CLASS_MEMBER_FROM_INLINE!>Generic<<!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>><!>() {}<!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!><!>
<!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!>null as <!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A.Nested<!><!>
- <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
+ <!IR_PRIVATE_TYPE_USED_IN_NON_PRIVATE_INLINE_FUNCTION_WARNING, UNUSED_EXPRESSION!><!LESS_VISIBLE_TYPE_ACCESS_IN_INLINE_WARNING!>A<!>::class<!>
}
}
}
@@ -98,7 +98,7 @@
object : Generic<A>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}
@@ -117,7 +117,7 @@
object : Generic<A>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}
}
@@ -146,7 +146,7 @@
object : <!PRIVATE_CLASS_MEMBER_FROM_INLINE!>Generic<A><!>() {}
null as A
null as A.Nested
- A::class
+ <!UNUSED_EXPRESSION!>A::class<!>
}
}.foo()
}
diff --git a/compiler/testData/diagnostics/nativeTests/cloneableInNative.fir.kt b/compiler/testData/diagnostics/nativeTests/cloneableInNative.fir.kt
index 3d6e17f..0b574c3 100644
--- a/compiler/testData/diagnostics/nativeTests/cloneableInNative.fir.kt
+++ b/compiler/testData/diagnostics/nativeTests/cloneableInNative.fir.kt
@@ -2,5 +2,5 @@
fun main() {
val x: kotlin.<!UNRESOLVED_REFERENCE!>Cloneable<!> = if (true) intArrayOf(1) else longArrayOf(1)
- x
+ <!UNUSED_EXPRESSION!>x<!>
}
diff --git a/compiler/testData/diagnostics/tests/ResolveToJava.fir.kt b/compiler/testData/diagnostics/tests/ResolveToJava.fir.kt
index efc0eee..d88c3ca 100644
--- a/compiler/testData/diagnostics/tests/ResolveToJava.fir.kt
+++ b/compiler/testData/diagnostics/tests/ResolveToJava.fir.kt
@@ -3,6 +3,7 @@
// SKIP_JAVAC
// FULL_JDK
// WITH_EXTRA_CHECKERS
+// DIAGNOSTICS: +UNUSED_VARIABLE
// FILE: a.kt
@@ -31,7 +32,7 @@
checkSubtype<Set<Int>?>(Collections.singleton<Int>(1))
Collections.singleton<Int>(<!ARGUMENT_TYPE_MISMATCH!>1.0<!>)
- <!NO_COMPANION_OBJECT, UNUSED_EXPRESSION!>List<Int><!>
+ <!NO_COMPANION_OBJECT!>List<Int><!>
val <!UNUSED_VARIABLE!>o<!> = "sdf" as <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Object<!>
diff --git a/compiler/testData/diagnostics/tests/ResolveToJava.kt b/compiler/testData/diagnostics/tests/ResolveToJava.kt
index 66cb22c..03302ff 100644
--- a/compiler/testData/diagnostics/tests/ResolveToJava.kt
+++ b/compiler/testData/diagnostics/tests/ResolveToJava.kt
@@ -3,6 +3,7 @@
// SKIP_JAVAC
// FULL_JDK
// WITH_EXTRA_CHECKERS
+// DIAGNOSTICS: +UNUSED_VARIABLE
// FILE: a.kt
@@ -16,12 +17,12 @@
val l : MutableList<in Int> = ArrayList<Int>()
fun test(l : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<Int><!>) {
- val x : java.<!UNRESOLVED_REFERENCE!>List<!>
- val y : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<Int><!>
- val b : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Object<!>
- val z : java.<!UNRESOLVED_REFERENCE!>utils<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>List<!><Int>
+ val <!UNUSED_VARIABLE!>x<!> : java.<!UNRESOLVED_REFERENCE!>List<!>
+ val <!UNUSED_VARIABLE!>y<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<Int><!>
+ val <!UNUSED_VARIABLE!>b<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Object<!>
+ val <!UNUSED_VARIABLE!>z<!> : java.<!UNRESOLVED_REFERENCE!>utils<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>List<!><Int>
- val f : java.io.File? = null
+ val <!UNUSED_VARIABLE!>f<!> : java.io.File? = null
Collections.<!FUNCTION_CALL_EXPECTED, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyList<!>
Collections.<!FUNCTION_CALL_EXPECTED!>emptyList<Int><!>
@@ -34,7 +35,7 @@
<!RESOLUTION_TO_CLASSIFIER!>List<!><Int>
- val o = "sdf" as <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Object<!>
+ val <!UNUSED_VARIABLE!>o<!> = "sdf" as <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Object<!>
try {
// ...
diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/breakInsideLocal.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/breakInsideLocal.fir.kt
index ef82955..424f444 100644
--- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/breakInsideLocal.fir.kt
+++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/breakInsideLocal.fir.kt
@@ -24,7 +24,7 @@
fun test2() {
while (true) {
- {tag: Int ->
+ <!UNUSED_LAMBDA_EXPRESSION!>{tag: Int ->
when(tag) {
0 -> <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!>
1 -> foo { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!> }
@@ -32,7 +32,7 @@
3 -> foo(fun () { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!> })
4 -> foo(@SomeAnnotation fun () { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!> })
}
- }
+ }<!>
}
}
diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1027.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1027.fir.kt
index 2d4090a..ea58eef 100644
--- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1027.fir.kt
+++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1027.fir.kt
@@ -43,7 +43,7 @@
fun t4() {
return
- (43)
+ (<!UNUSED_EXPRESSION!>43<!>)
}
fun doSmth() {}
diff --git a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.fir.kt
index e794568..01977b1 100644
--- a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.fir.kt
+++ b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.fir.kt
@@ -2,16 +2,16 @@
// DIAGNOSTICS: +UNUSED_LAMBDA_EXPRESSION, +UNUSED_VARIABLE
fun unusedLiteral(){
- { ->
+ <!UNUSED_LAMBDA_EXPRESSION!>{ ->
val i = 1
- }
+ }<!>
}
fun unusedLiteralInDoWhile(){
- do{ ->
+ do<!UNUSED_LAMBDA_EXPRESSION!>{ ->
val i = 1
- } while(false)
+ }<!> while(false)
}
/* GENERATED_FIR_TAGS: doWhileLoop, functionDeclaration, integerLiteral, lambdaLiteral, localProperty,
diff --git a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.fir.kt
deleted file mode 100644
index 91d63f1..0000000
--- a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.fir.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN_PIPELINE_TILL: BACKEND
-// DIAGNOSTICS: +UNUSED_LAMBDA_EXPRESSION
-
-fun main() {
- "".run {
- {}
- }
-}
-
-
-fun <T> T.run(f: (T) -> Unit): Unit = f(this)
-
-/* GENERATED_FIR_TAGS: funWithExtensionReceiver, functionDeclaration, functionalType, lambdaLiteral, nullableType,
-stringLiteral, thisExpression, typeParameter */
diff --git a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt
index 7e322ae..c1e7368 100644
--- a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt
+++ b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt
@@ -1,3 +1,4 @@
+// FIR_IDENTICAL
// RUN_PIPELINE_TILL: BACKEND
// DIAGNOSTICS: +UNUSED_LAMBDA_EXPRESSION
diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/runtimeCrashOnInnerWithImplicitInArgument.fir.diag.txt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/runtimeCrashOnInnerWithImplicitInArgument.fir.diag.txt
index 1fd8885..2ab9310 100644
--- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/runtimeCrashOnInnerWithImplicitInArgument.fir.diag.txt
+++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/runtimeCrashOnInnerWithImplicitInArgument.fir.diag.txt
@@ -1 +1,3 @@
/runtimeCrashOnInnerWithImplicitInArgument.fir.kt:(298,303): error: Type parameter 'T' is declared as 'in' but occurs in 'out' position in type 'In.Inner<T (of class In<in T>)>'.
+
+/runtimeCrashOnInnerWithImplicitInArgument.fir.kt:(407,409): warning: Expression is unused.
diff --git a/compiler/testData/diagnostics/tests/inline/nonPublicMember/kt55179.fir.diag.txt b/compiler/testData/diagnostics/tests/inline/nonPublicMember/kt55179.fir.diag.txt
index cbc08a6..bb682c9 100644
--- a/compiler/testData/diagnostics/tests/inline/nonPublicMember/kt55179.fir.diag.txt
+++ b/compiler/testData/diagnostics/tests/inline/nonPublicMember/kt55179.fir.diag.txt
@@ -6,6 +6,8 @@
/kt55179.fir.kt:(323,326): error: The signature of 'constructor(): Foo' contains 'private-in-file' type 'Foo', but is accessed from 'internal' inline declaration.
+/kt55179.fir.kt:(333,346): warning: Expression is unused.
+
/kt55179.fir.kt:(337,346): error: 'private-in-file' type 'Foo.Companion' is accessed from 'internal' inline declaration.
/kt55179.fir.kt:(337,346): error: Non-private inline function 'fun foo(): Unit' cannot access members of private class 'companion object Companion : Any'.
diff --git a/compiler/testData/diagnostics/tests/j+k/kt2641.fir.kt b/compiler/testData/diagnostics/tests/j+k/kt2641.fir.kt
index 2ccc48e..f1f7e3a 100644
--- a/compiler/testData/diagnostics/tests/j+k/kt2641.fir.kt
+++ b/compiler/testData/diagnostics/tests/j+k/kt2641.fir.kt
@@ -10,9 +10,9 @@
import checkSubtype
fun bar(any: Any): <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Iterable<Int><!>? {
- val <!UNUSED_VARIABLE!>a<!>: <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<String><!>? = null
- val <!UNUSED_VARIABLE!>b<!>: Iterable<<!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Integer<!>>
- val <!UNUSED_VARIABLE!>c<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<String><!>? = null
+ val a: <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<String><!>? = null
+ val b: Iterable<<!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Integer<!>>
+ val c : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<String><!>? = null
if (any is <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<*><!>) {
checkSubtype<<!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<*><!>>(any)
diff --git a/compiler/testData/diagnostics/tests/multimodule/inaccessibleSuperTypeWithRepeatedContext.fir.diag.txt b/compiler/testData/diagnostics/tests/multimodule/inaccessibleSuperTypeWithRepeatedContext.fir.diag.txt
index 65132cb..cd987dd 100644
--- a/compiler/testData/diagnostics/tests/multimodule/inaccessibleSuperTypeWithRepeatedContext.fir.diag.txt
+++ b/compiler/testData/diagnostics/tests/multimodule/inaccessibleSuperTypeWithRepeatedContext.fir.diag.txt
@@ -1,7 +1,11 @@
/c.kt:(90,109): error: Cannot access 'MissedInterface' which is a supertype of 'Implementation'. Check your module classpath for missing or conflicting dependencies.
+/c.kt:(114,116): warning: Expression is unused.
+
/c.kt:(131,143): error: Cannot access 'MissedInterface' which is a supertype of 'Implementation'. Check your module classpath for missing or conflicting dependencies.
/c.kt:(131,143): warning: Cannot access 'MissedInterface' which is a supertype of 'Intermediate'. This may be forbidden soon. Check the module classpath for missing or conflicting dependencies.
/c.kt:(131,143): error: Cannot access class 'MissedInterface'. Check your module classpath for missing or conflicting dependencies.
+
+/c.kt:(148,150): warning: Expression is unused.
diff --git a/compiler/testData/diagnostics/tests/samConversions/samConversionToGenericWrongNullability.fir.diag.txt b/compiler/testData/diagnostics/tests/samConversions/samConversionToGenericWrongNullability.fir.diag.txt
index 7aa12de..7d40ad4 100644
--- a/compiler/testData/diagnostics/tests/samConversions/samConversionToGenericWrongNullability.fir.diag.txt
+++ b/compiler/testData/diagnostics/tests/samConversions/samConversionToGenericWrongNullability.fir.diag.txt
@@ -14,6 +14,10 @@
/test.kt:(788,810): warning: Argument type mismatch: actual type is 'String?', but 'String' was expected. This will become an error in language version 2.1. See https://youtrack.jetbrains.com/issue/KT-57014.
+/test.kt:(823,824): warning: Expression is unused.
+
+/test.kt:(857,861): warning: Expression is unused.
+
/test.kt:(967,989): warning: Argument type mismatch: actual type is 'String?', but 'String' was expected. This will become an error in language version 2.1. See https://youtrack.jetbrains.com/issue/KT-57014.
/test.kt:(1076,1098): warning: Argument type mismatch: actual type is 'String?', but 'String' was expected. This will become an error in language version 2.1. See https://youtrack.jetbrains.com/issue/KT-57014.
diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.fir.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.fir.kt
index 9e8fb34..f8fd8c6 100644
--- a/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.fir.kt
+++ b/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.fir.kt
@@ -2,9 +2,9 @@
// DIAGNOSTICS: +UNUSED_PARAMETER +UNUSED_LAMBDA_EXPRESSION +UNUSED_VARIABLE
fun f(i: Int) {
for (j in 1..100) {
- {
+ <!UNUSED_LAMBDA_EXPRESSION!>{
var i = 12
- }
+ }<!>
}
}
diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.fir.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.fir.kt
index fc080a3..3f3d01a 100644
--- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.fir.kt
+++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.fir.kt
@@ -2,9 +2,9 @@
// DIAGNOSTICS: +UNUSED_LAMBDA_EXPRESSION +UNUSED_VARIABLE
fun ff(): Int {
var i = 1
- {
+ <!UNUSED_LAMBDA_EXPRESSION!>{
val i = 2
- }
+ }<!>
return i
}
diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.fir.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.fir.kt
index a2e3af1..a0236b4 100644
--- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.fir.kt
+++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.fir.kt
@@ -2,7 +2,7 @@
// DIAGNOSTICS: +UNUSED_LAMBDA_EXPRESSION +UNUSED_VARIABLE
fun f(): Int {
var i = 17
- { var i = 18 }
+ <!UNUSED_LAMBDA_EXPRESSION!>{ var i = 18 }<!>
return i
}
diff --git a/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.diag.txt b/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.diag.txt
index fc03124..9d2fafe 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.diag.txt
+++ b/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.diag.txt
@@ -22,6 +22,10 @@
/labelClashes.fir.kt:(433,436): error: Unresolved reference 'foo'.
+/labelClashes.fir.kt:(615,629): warning: Expression is unused.
+
+/labelClashes.fir.kt:(671,685): warning: Expression is unused.
+
/labelClashes.fir.kt:(744,748): error: Cannot infer type for type parameter 'R'. Specify it explicitly.
/labelClashes.fir.kt:(771,776): warning: There is more than one label with such a name in this scope.
diff --git a/compiler/testData/diagnostics/testsWithStdLib/labelClashesWithContextReceivers.fir.diag.txt b/compiler/testData/diagnostics/testsWithStdLib/labelClashesWithContextReceivers.fir.diag.txt
index 7d6f239..4234e25 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/labelClashesWithContextReceivers.fir.diag.txt
+++ b/compiler/testData/diagnostics/testsWithStdLib/labelClashesWithContextReceivers.fir.diag.txt
@@ -4,8 +4,12 @@
See the context parameters proposal for more details: https://kotl.in/context-parameters
This warning will become an error in future releases.
+/labelClashesWithContextReceivers.fir.kt:(264,273): warning: Expression is unused.
+
/labelClashesWithContextReceivers.fir.kt:(268,273): error: Ambiguous label.
+/labelClashesWithContextReceivers.fir.kt:(282,293): warning: Expression is unused.
+
/labelClashesWithContextReceivers.fir.kt:(305,312): warning: Experimental context receivers are superseded by context parameters.
Replace the '-Xcontext-receivers' compiler argument with '-Xcontext-parameters' and migrate to the new syntax.
@@ -14,4 +18,8 @@
/labelClashesWithContextReceivers.fir.kt:(358,363): error: Ambiguous label.
+/labelClashesWithContextReceivers.fir.kt:(460,474): warning: Expression is unused.
+
/labelClashesWithContextReceivers.fir.kt:(464,474): error: Ambiguous label.
+
+/labelClashesWithContextReceivers.fir.kt:(516,530): warning: Expression is unused.
diff --git a/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/configuration/BaseDiagnosticConfiguration.kt b/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/configuration/BaseDiagnosticConfiguration.kt
index dabcae1..4dd3b32 100644
--- a/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/configuration/BaseDiagnosticConfiguration.kt
+++ b/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/configuration/BaseDiagnosticConfiguration.kt
@@ -43,6 +43,7 @@
import org.jetbrains.kotlin.test.model.DependencyKind
import org.jetbrains.kotlin.test.model.FrontendFacade
import org.jetbrains.kotlin.test.model.FrontendKinds
+import org.jetbrains.kotlin.test.runners.AbstractDiagnosticTest.Companion.DEFAULT_UNUSED_DIAGNOSTICS
import org.jetbrains.kotlin.test.runners.DuplicateFileNameChecker
import org.jetbrains.kotlin.test.services.LibraryProvider
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator
@@ -124,6 +125,7 @@
defaultDirectives {
LANGUAGE + "+EnableDfaWarningsInK2"
+ DIAGNOSTICS with DEFAULT_UNUSED_DIAGNOSTICS.map { "-$it" }
}
enableMetaInfoHandler()
@@ -221,6 +223,7 @@
defaultDirectives {
RETURN_VALUE_CHECKER_MODE with ReturnValueCheckerMode.CHECKER
+WITH_EXTRA_CHECKERS
+ DIAGNOSTICS with DEFAULT_UNUSED_DIAGNOSTICS.map { "+$it" }
DIAGNOSTICS with "-UNUSED_VARIABLE"
LANGUAGE with "+UnnamedLocalVariables"
}
@@ -230,6 +233,7 @@
defaultDirectives {
RETURN_VALUE_CHECKER_MODE with ReturnValueCheckerMode.FULL
+WITH_EXTRA_CHECKERS
+ DIAGNOSTICS with DEFAULT_UNUSED_DIAGNOSTICS.map { "+$it" }
DIAGNOSTICS with "-UNUSED_VARIABLE"
LANGUAGE with "+UnnamedLocalVariables"
}
@@ -241,12 +245,19 @@
}
}
+ forTestsMatching("compiler/testData/diagnostics/tests/controlFlowAnalysis/*") {
+ defaultDirectives {
+ DIAGNOSTICS with DEFAULT_UNUSED_DIAGNOSTICS.map { "+$it" }
+ }
+ }
+
forTestsMatching(
"compiler/fir/analysis-tests/testData/resolve/extraCheckers/*" or
"compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/*"
) {
defaultDirectives {
+WITH_EXTRA_CHECKERS
+ DIAGNOSTICS with DEFAULT_UNUSED_DIAGNOSTICS.map { "+$it" }
}
}
diff --git a/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt b/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt
index d3834d4..98a03ab 100644
--- a/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt
+++ b/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt
@@ -39,7 +39,7 @@
abstract class AbstractDiagnosticTest : AbstractKotlinCompilerTest() {
companion object {
- val DISABLED_BY_DEFAULT_UNUSED_DIAGNOSTICS = listOf(
+ val DEFAULT_UNUSED_DIAGNOSTICS = listOf(
"UNUSED_VARIABLE",
"UNUSED_PARAMETER",
"UNUSED_ANONYMOUS_PARAMETER",
@@ -49,7 +49,7 @@
"UNUSED_CHANGED_VALUE",
"UNUSED_EXPRESSION",
"UNUSED_LAMBDA_EXPRESSION",
- ).map { "-$it" }
+ )
}
override fun configure(builder: TestConfigurationBuilder) = with(builder) {
@@ -61,6 +61,7 @@
defaultDirectives {
+USE_PSI_CLASS_FILES_READING
+ DIAGNOSTICS with DEFAULT_UNUSED_DIAGNOSTICS.map { "-$it" }
}
enableMetaInfoHandler()
@@ -132,9 +133,9 @@
}
}
- forTestsNotMatching("compiler/testData/diagnostics/tests/controlFlowAnalysis/*") {
+ forTestsMatching("compiler/testData/diagnostics/tests/controlFlowAnalysis/*") {
defaultDirectives {
- DIAGNOSTICS with DISABLED_BY_DEFAULT_UNUSED_DIAGNOSTICS
+ DIAGNOSTICS with DEFAULT_UNUSED_DIAGNOSTICS.map { "+$it" }
}
}
diff --git a/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/runners/AbstractFirPhasedDiagnosticTest.kt b/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/runners/AbstractFirPhasedDiagnosticTest.kt
index f6e7ad9..28d5446a 100644
--- a/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/runners/AbstractFirPhasedDiagnosticTest.kt
+++ b/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/runners/AbstractFirPhasedDiagnosticTest.kt
@@ -20,6 +20,7 @@
import org.jetbrains.kotlin.test.configuration.commonConfigurationForJvmTest
import org.jetbrains.kotlin.test.configuration.configureCommonDiagnosticTestPaths
import org.jetbrains.kotlin.test.configuration.setupHandlersForDiagnosticTest
+import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.DIAGNOSTICS
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.LANGUAGE
import org.jetbrains.kotlin.test.directives.TestPhaseDirectives.LATEST_PHASE_IN_PIPELINE
import org.jetbrains.kotlin.test.directives.configureFirParser
@@ -29,6 +30,7 @@
import org.jetbrains.kotlin.test.frontend.fir.handlers.NonSourceErrorMessagesHandler
import org.jetbrains.kotlin.test.frontend.fir.handlers.PsiLightTreeMetaInfoProcessor
import org.jetbrains.kotlin.test.model.FrontendKinds
+import org.jetbrains.kotlin.test.runners.AbstractDiagnosticTest.Companion.DEFAULT_UNUSED_DIAGNOSTICS
import org.jetbrains.kotlin.test.services.PhasedPipelineChecker
import org.jetbrains.kotlin.test.services.TestPhase
import org.jetbrains.kotlin.utils.bind
@@ -38,6 +40,7 @@
defaultDirectives {
LATEST_PHASE_IN_PIPELINE with TestPhase.BACKEND
LANGUAGE + "+EnableDfaWarningsInK2"
+ DIAGNOSTICS with DEFAULT_UNUSED_DIAGNOSTICS.map { "-$it" }
}
commonConfigurationForJvmTest(
diff --git a/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/services/DiagnosticsService.kt b/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/services/DiagnosticsService.kt
index f63fac8..1d10f42 100644
--- a/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/services/DiagnosticsService.kt
+++ b/compiler/tests-common-new/testFixtures/org/jetbrains/kotlin/test/services/DiagnosticsService.kt
@@ -8,7 +8,6 @@
import org.jetbrains.kotlin.diagnostics.Severity
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives
import org.jetbrains.kotlin.test.model.TestModule
-import org.jetbrains.kotlin.test.util.*
class DiagnosticsService(val testServices: TestServices) : TestService {
companion object {
@@ -43,8 +42,7 @@
private fun computeDiagnosticConditionForModule(module: TestModule): DiagnosticConditions {
val diagnosticsInDirective = module.directives[DiagnosticsDirectives.DIAGNOSTICS]
- val enabledNames = mutableSetOf<String>()
- val disabledNames = mutableSetOf<String>()
+ val diagnosticMap = mutableMapOf<String, Boolean>()
val severityMap = mutableMapOf<Severity, Boolean>()
for (diagnosticInDirective in diagnosticsInDirective) {
val enabled = when {
@@ -57,10 +55,19 @@
if (severity != null) {
severityMap[severity] = enabled
} else {
- val collection = if (enabled) enabledNames else disabledNames
- collection += name
+ diagnosticMap[name] = enabled
}
}
+
+ val enabledNames = mutableSetOf<String>()
+ val disabledNames = mutableSetOf<String>()
+ for ((name, enabled) in diagnosticMap) {
+ when (enabled) {
+ true -> enabledNames += name
+ false -> disabledNames += name
+ }
+ }
+
return DiagnosticConditions(
enabledNames,
disabledNames,
diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt
index 6258735..f5a0840 100644
--- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt
+++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt
@@ -246,7 +246,7 @@
// TESTCASE NUMBER: 15
fun case_15(x: EmptyObject) {
- val <!UNUSED_VARIABLE!>t<!> = if (<!FORBIDDEN_IDENTITY_EQUALS!>x === <!USELESS_IS_CHECK!><!USELESS_IS_CHECK!>null is Boolean is Boolean<!> is Boolean<!><!>) "" else {
+ val t = if (<!FORBIDDEN_IDENTITY_EQUALS!>x === <!USELESS_IS_CHECK!><!USELESS_IS_CHECK!>null is Boolean is Boolean<!> is Boolean<!><!>) "" else {
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject")!>x<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject")!>x<!>.propT
diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt
index 55f88b0..a934b1f 100644
--- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt
+++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt
@@ -180,7 +180,7 @@
// TESTCASE NUMBER: 15
fun case_15(x: TypealiasNullableString) {
- val <!UNUSED_VARIABLE!>t<!> = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>if (x != null) "" else {
+ val t = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>if (x != null) "" else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
}<!>
}
diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt
index f5f8489..c006957 100644
--- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt
+++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt
@@ -289,7 +289,7 @@
// TESTCASE NUMBER: 15
fun case_15(x: TypealiasNullableString) {
val y = null
- val <!UNUSED_VARIABLE!>z<!> = if (x === null || <!SENSELESS_COMPARISON!>y == x<!> && <!SENSELESS_COMPARISON!>x === y<!> || <!SENSELESS_COMPARISON!>null === x<!>) "" else {
+ val z = if (x === null || <!SENSELESS_COMPARISON!>y == x<!> && <!SENSELESS_COMPARISON!>x === y<!> || <!SENSELESS_COMPARISON!>null === x<!>) "" else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>x<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>x<!>.propT
@@ -907,7 +907,7 @@
fun case_50(x: TypealiasNullableString) {
val z1 = null
val z2 = null
- val <!UNUSED_VARIABLE!>t<!> = if (x != z1 && <!SENSELESS_COMPARISON!>z2 !== x<!>) "" else {
+ val t = if (x != z1 && <!SENSELESS_COMPARISON!>z2 !== x<!>) "" else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!>.hashCode()
}
diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt
index 5f7dfd7..8a77a50 100644
--- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt
+++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt
@@ -274,7 +274,7 @@
// TESTCASE NUMBER: 15
fun case_15(x: TypealiasString?) {
<!CAN_BE_VAL!>var<!> y = null
- val <!UNUSED_VARIABLE!>t<!> = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>if (x === null || <!SENSELESS_COMPARISON!>x == y<!> && <!SENSELESS_COMPARISON!>x === y<!>) "" else {
+ val t = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>if (x === null || <!SENSELESS_COMPARISON!>x == y<!> && <!SENSELESS_COMPARISON!>x === y<!>) "" else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>x<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>x<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>x<!>.propAny
diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/commonMain/kotlin/ConsumerACommon.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/commonMain/kotlin/ConsumerACommon.kt
index 800fcda..f84824c 100644
--- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/commonMain/kotlin/ConsumerACommon.kt
+++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/commonMain/kotlin/ConsumerACommon.kt
@@ -3,6 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
+@Suppress("UNUSED_EXPRESSION")
object ConsumerACommon {
init {
ProducerACommonX
diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/linuxX64Main/kotlin/ConsumerALinuxX64.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/linuxX64Main/kotlin/ConsumerALinuxX64.kt
index b258625..611a9cc 100644
--- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/linuxX64Main/kotlin/ConsumerALinuxX64.kt
+++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/linuxX64Main/kotlin/ConsumerALinuxX64.kt
@@ -5,6 +5,7 @@
import clib.myCFunction
+@Suppress("UNUSED_EXPRESSION")
object ConsumerALinuxX64 {
init {
ProducerACommonX
diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/nativeMain/kotlin/ConsumerANative.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/nativeMain/kotlin/ConsumerANative.kt
index 9bd1583..0c1915c 100644
--- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/nativeMain/kotlin/ConsumerANative.kt
+++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/mpp-composite-build/sample4-KT-37051-withCInterop/consumerBuild/consumerA/src/nativeMain/kotlin/ConsumerANative.kt
@@ -7,6 +7,7 @@
import kotlinx.cinterop.memScoped
import platform.posix.fopen
+@Suppress("UNUSED_EXPRESSION")
object ConsumerANative {
init {
memScoped { }
diff --git a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/analysis/ComposableCheckerTests.kt b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/analysis/ComposableCheckerTests.kt
index b6d5012..41a681e 100644
--- a/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/analysis/ComposableCheckerTests.kt
+++ b/plugins/compose/compiler-hosted/integration-tests/src/jvmTest/kotlin/androidx/compose/compiler/plugins/kotlin/analysis/ComposableCheckerTests.kt
@@ -1771,9 +1771,9 @@
}
@Composable fun Test(a: A) {
- <!COMPOSABLE_PROPERTY_REFERENCE!>a::bar<!>
- <!COMPOSABLE_PROPERTY_REFERENCE!>::globalProp<!>
- ::prop
+ <!UNUSED_EXPRESSION,COMPOSABLE_PROPERTY_REFERENCE!>a::bar<!>
+ <!UNUSED_EXPRESSION,COMPOSABLE_PROPERTY_REFERENCE!>::globalProp<!>
+ <!UNUSED_EXPRESSION!>::prop<!>
}
"""
)