Introduce warnings reporting by missed constraints because of incorrect optimization in the constraints processor
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
sealed class Subtype<A1, B1> {
|
||||
abstract fun cast(value: A1): B1
|
||||
class Trivial<A2 : B2, B2> : Subtype<A2, B2>() {
|
||||
override fun cast(value: A2): B2 = value
|
||||
}
|
||||
}
|
||||
|
||||
fun <A, B> unsafeCast(value: A): B {
|
||||
val proof: Subtype<A, B> = Subtype.Trivial()
|
||||
return proof.cast(value)
|
||||
}
|
||||
|
||||
fun box() = "OK"
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FILE: MySettings.java
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class MySettings<
|
||||
SS extends MySettings<SS, PS, L>,
|
||||
PS extends MyComparableSettings,
|
||||
L extends MySettingsListener<PS>
|
||||
>
|
||||
{
|
||||
public Collection<PS> getLinkedProjectsSettings() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public static MySettings getSettings() {
|
||||
return new MySettings();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class MyComparableSettings implements Comparable<MyComparableSettings> {}
|
||||
abstract class MySettingsListener<S extends MyComparableSettings> {}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun box(): String {
|
||||
val a = MySettings.getSettings()
|
||||
a.getLinkedProjectsSettings()
|
||||
a.linkedProjectsSettings
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS
|
||||
|
||||
fun <E : Enum<E>> createMap(enumClass: Class<E>) {}
|
||||
|
||||
enum class A
|
||||
|
||||
fun box(): String {
|
||||
val enumClass: Class<Enum<*>> = A::class.java as Class<Enum<*>>
|
||||
createMap(enumClass)
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user