[stdlib] Make @LowPriorityInOverloadResolution applicable to ctors
This commit is contained in:
+12
@@ -12,8 +12,20 @@ fun bar(a: String?) = 3
|
||||
|
||||
fun bar(a: Any) = 4
|
||||
|
||||
class MyString(val value: String)
|
||||
|
||||
class Baz
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
constructor(val s: String) {
|
||||
constructor(s: MyString): this(s.value)
|
||||
}
|
||||
|
||||
fun Baz(s: String) = Baz(MyString(s + "!"))
|
||||
|
||||
fun box(): String {
|
||||
if (foo(1) != 2) return "fail1"
|
||||
if (bar(null) != 3) return "fail2"
|
||||
if (Baz("hello").s != "hello!") return "fail3"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user