c458393e2f
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
25 lines
660 B
Kotlin
Vendored
25 lines
660 B
Kotlin
Vendored
// !WITH_NEW_INFERENCE
|
|
fun bar(x: Int) = x + 1
|
|
|
|
fun f1(x: Int?) {
|
|
bar(<!TYPE_MISMATCH!>x<!>)
|
|
if (x != null) bar(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
|
|
if (x == null) <!UNREACHABLE_CODE!>bar(<!><!ALWAYS_NULL!>x<!>!!<!UNREACHABLE_CODE!>)<!>
|
|
}
|
|
|
|
fun f2(x: Int?) {
|
|
if (x != null) else <!ALWAYS_NULL!>x<!>!!
|
|
}
|
|
|
|
fun f3(x: Int?) {
|
|
if (x != null) bar(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>) else <!ALWAYS_NULL!>x<!>!!
|
|
}
|
|
|
|
fun f4(x: Int?) {
|
|
if (x == null) <!ALWAYS_NULL!>x<!>!! else bar(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
|
|
}
|
|
|
|
fun f5(x: Int?) {
|
|
if (x == null) else bar(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
|
|
}
|