// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE annotation class ValueContainer @ValueContainer data class StringProperty(var v: String) { fun assign(v: String) { this.v = v } fun assign(v: StringProperty) { this.v = v.get() } fun get(): String = v } fun `should not work with local val for different type`() { val property = StringProperty("OK") property = "Fail" } fun `should not work with local val for same type`() { val property = StringProperty("OK") property = StringProperty("Fail") } fun `should not work with local var for different type`() { var property = StringProperty("OK") property = "Fail" } fun `should work with local var for same type`() { var property = StringProperty("OK") property = StringProperty("Fail") } fun `should not work with method parameters`() { fun m1(property: StringProperty): Unit { property = "Fail" } fun m2(property: StringProperty): Unit { property = StringProperty("Fail") } }