J2K: Insert !! for expression only if NotNull expected (not for Default nullability)

This commit is contained in:
Natalia Ukhorskaya
2016-03-29 11:12:53 +03:00
parent 98c3b39f7e
commit 72019a1b4e
3 changed files with 11 additions and 5 deletions
+4 -2
View File
@@ -1,3 +1,5 @@
// ERROR: Type mismatch: inferred type is Passenger.PassChild? but Passenger.PassChild was expected
// ERROR: Type mismatch: inferred type is Passenger.PassChild? but Passenger.PassChild was expected
class Passenger {
open class PassParent
@@ -16,9 +18,9 @@ class Passenger {
val pass = provideNullable(1)
if (1 == 2) {
assert(pass != null)
accept2((pass as PassChild?)!!)
accept2(pass as PassChild?)
}
accept2((pass as PassChild?)!!)
accept2(pass as PassChild?)
}
fun accept1(p: PassChild) {