Fix false positive unreachable code in case of Nothing!-typed calls

Note, that this change potentially has some other effects in corner cases
(like the changed test data that is rather sensible because `bar`
in the example is not effectively projected out and can be called
with nulls)

Probably, we need to consider rewriting all other isSomeType methods
in KotlinBuiltins, but now it seems to be a rather dangerous change

 #KT-16424 Fixed
This commit is contained in:
Denis Zharkov
2018-03-12 14:57:16 +03:00
parent a7854bc0ce
commit cff88a3f8b
6 changed files with 44 additions and 3 deletions
@@ -17,7 +17,8 @@ fun main(a: A<*>, j: JavaClass<*>, i2: Inv2<*>) {
j.foo() checkType { <!NI;DEBUG_INFO_UNRESOLVED_WITH_TARGET, NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() }
i2.x checkType { <!NI;DEBUG_INFO_UNRESOLVED_WITH_TARGET, NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() }
j.<!OI;MEMBER_PROJECTED_OUT!>bar<!>(<!NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>, <!NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>2<!>, <!NI;TYPE_MISMATCH!>Any()<!>)
j.bar(<!NI;CONSTANT_EXPECTED_TYPE_MISMATCH, OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>, <!NI;CONSTANT_EXPECTED_TYPE_MISMATCH, OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>2<!>, <!NI;TYPE_MISMATCH, OI;TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>Any()<!>)
j.bar(null)
}
// FILE: JavaClass.java