Fix for a problem with smart cast impossible in a situation when it's not needed. A test for KT-3572. #KT-3572 Fixed.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
trait Printer {
|
||||
fun print()
|
||||
}
|
||||
|
||||
class OKPrinter : Printer {
|
||||
override fun print() { }
|
||||
}
|
||||
|
||||
class MyClass(var printer: Printer)
|
||||
|
||||
|
||||
fun main(m: MyClass) {
|
||||
if (m.printer is OKPrinter) {
|
||||
// We do not need smart cast here, so we should not get SMARTCAST_IMPOSSIBLE
|
||||
m.printer.print()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user