//KT-1355 Type inference fails with smartcast and generic function //tests for Map.set package a import java.util.HashMap fun foo(map: MutableMap, value: String?) { if (value != null) { map.put(1, value) //ok map.set(1, value) //type inference failed map[1] = value //type inference failed } } //--------------------------- public data class Tag(public var tagName: String) { public val attributes: MutableMap = HashMap() public val contents: MutableList = arrayListOf() public var id: String? get() = attributes["id"] set(value) { if(value == null) { attributes.remove("id") } else { attributes["id"] = value!! attributes["id"] = value } } } //from library operator fun MutableMap.set(key : K, value : V) = this.put(key, value) fun arrayListOf(vararg values: T): MutableList = throw Exception()