Skip to content

Commit 524070c

Browse files
merfemorSpace Team
authored andcommitted
[Test] Tests reproducing missing diagnostics with flexible primitives
^KT-76984
1 parent 23019ab commit 524070c

5 files changed

+11
-0
lines changed

compiler/testData/diagnostics/tests/identitySensitiveOperationsOnValueClassesAndPrimitivesWarningsDisabled.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ value class VcString(val s: String)
1010
fun test(p1: Int, p2: VcString) {
1111
System.identityHashCode(p1)
1212
System.identityHashCode(p2)
13+
System.identityHashCode(Integer.valueOf(1))
1314
}

compiler/testData/diagnostics/tests/identitySensitiveOperationsOnValueObjectsWarning.fir.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,7 @@ fun testTypeParameters() {
6565
val t1: Map<Int, Any> = <!IDENTITY_SENSITIVE_OPERATIONS_WITH_VALUE_TYPE!>WeakHashMap<!>()
6666
val t2: Map<Int, Any> = WeakHashMap<<!IDENTITY_SENSITIVE_OPERATIONS_WITH_VALUE_TYPE!>_<!>, _>()
6767
}
68+
69+
fun testFlexibleTypes() {
70+
System.identityHashCode(Integer.valueOf(1))
71+
}

compiler/testData/diagnostics/tests/identitySensitiveOperationsOnValueObjectsWarning.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,7 @@ fun testTypeParameters() {
6565
val t1: Map<Int, Any> = WeakHashMap()
6666
val t2: Map<Int, Any> = WeakHashMap<_, _>()
6767
}
68+
69+
fun testFlexibleTypes() {
70+
System.identityHashCode(Integer.valueOf(1))
71+
}

compiler/testData/diagnostics/tests/synchronizedOnJavaValueBasedWarning.fir.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ typealias LocalDateAlias = java.time.LocalDate
1010
fun test(p1: java.time.LocalDate, p2: LocalDateAlias) {
1111
synchronized(<!SYNCHRONIZED_BLOCK_ON_JAVA_VALUE_BASED_CLASS!>p1<!>) { }
1212
synchronized(<!SYNCHRONIZED_BLOCK_ON_JAVA_VALUE_BASED_CLASS!>p2<!>) { }
13+
synchronized(Integer.valueOf(1)) {}
1314
}

compiler/testData/diagnostics/tests/synchronizedOnJavaValueBasedWarning.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ typealias LocalDateAlias = java.time.LocalDate
1010
fun test(p1: java.time.LocalDate, p2: LocalDateAlias) {
1111
synchronized(p1) { }
1212
synchronized(p2) { }
13+
<!FORBIDDEN_SYNCHRONIZED_BY_VALUE_CLASSES_OR_PRIMITIVES!>synchronized<!>(Integer.valueOf(1)) {}
1314
}

0 commit comments

Comments
 (0)