Autocast `this` regression in M3?


#1

With last update (0.1.3395) which I've install with Idea12 EAP the following code begins to throw an Exception.

``

open class Test1 {
  fun report() =
  if (this is Test2)
  “Test2({this.value})”
  else
  “Test1()”
}

class Test2(val value: Int)

fun main(args: Array<String>) {
  val test = Test(10)
// throws Exception in thread “main” java.lang.VerifyError: (class: Test1, method: report signature: ()Ljava/lang/String;)
//   Incompatible object argument for function call
}

It works if add explicit cast with as keyword

``

  fun report() =
  if (this is Test2)
  “Test2({(this as Test2).value})”
  else
  "Test1()


#2

THanks for the report. I've created http://youtrack.jetbrains.com/issue/KT-2811