Advertisement
Guest User

Kotlin lateinit Bad type on operand stack

a guest
Jul 7th, 2020
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.38 KB | None | 0 0
  1.     @Test
  2.     internal fun `Bad type on operand stack`() {
  3.         val a = TestClass()
  4.         val b = TestClass()
  5.         a.doVerifyError(b)
  6.     }
  7.  
  8.     class TestClass {
  9.         lateinit var lateInitField: String
  10.  
  11.         fun doVerifyError(other: Any?): Boolean {
  12.             if(other !is TestClass) return false
  13.             return other::lateInitField.isInitialized
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement