[NI] Do not avoid trivial constraints if they aren't from upper bounds
Since we skipped trivial constraint with `Any?` from parameter type of function `equals`, the compiler thought that there is no proper constraints (upper bounds do not matter here) and marked resolved call as a failed one, then diagnostic about missing equals was added Also, tune `TrivialConstraintTypeInferenceOracle` for `Any?`-like constraints #KT-30724 Fixed
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
fun test1(): Int {
|
||||
val x: String = <!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>if (true) {
|
||||
val x: String = <!NI;TYPE_MISMATCH!>if (true) {
|
||||
when {
|
||||
true -> <!OI;TYPE_MISMATCH!>Any()<!>
|
||||
else -> <!OI;NULL_FOR_NONNULL_TYPE!>null<!>
|
||||
@@ -10,7 +10,7 @@ fun test1(): Int {
|
||||
}
|
||||
|
||||
fun test2(): Int {
|
||||
val x: String = <!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>when {
|
||||
val x: String = <!NI;TYPE_MISMATCH!>when {
|
||||
true -> <!OI;TYPE_MISMATCH!>Any()<!>
|
||||
else -> null
|
||||
} ?: return 0<!>
|
||||
|
||||
Reference in New Issue
Block a user