K1: add diagnostic BUILDER_INFERENCE_STUB_RECEIVER
It's reported on receivers in extension function calls with stub type, as such calls can shadow members of finalized stub types causing change of resolve when corresponding type argument specified explicitly It works by checking extension receiver during call resolution parts run That way we can easily detect if we found an extension applicable to stub receiver and report call diagnostic for it KT-53739
This commit is contained in:
committed by
teamcity
parent
105358dcf6
commit
154e53c701
@@ -20,9 +20,10 @@ fun box(): String {
|
||||
val ret = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
get()?.test()
|
||||
get()?.test2()
|
||||
get().test2()
|
||||
// Error, resolved to extension on stub receiver
|
||||
// get()?.test()
|
||||
// get()?.test2()
|
||||
// get().test2()
|
||||
get()?.hashCode()
|
||||
get()?.equals(1)
|
||||
val x = get()
|
||||
@@ -38,9 +39,10 @@ fun box(): String {
|
||||
x.equals("")
|
||||
x.hashCode()
|
||||
x.toString()
|
||||
x.test()
|
||||
x?.test2()
|
||||
x.test2()
|
||||
// Error, resolved to extension on stub receiver
|
||||
// x.test()
|
||||
// x?.test2()
|
||||
// x.test2()
|
||||
}
|
||||
|
||||
if (x == null) {
|
||||
@@ -50,8 +52,9 @@ fun box(): String {
|
||||
// x.hashCode()
|
||||
// x.toString()
|
||||
// x.test()
|
||||
x?.test2()
|
||||
x.test2()
|
||||
// Error, resolved to extension on stub receiver
|
||||
// x?.test2()
|
||||
// x.test2()
|
||||
}
|
||||
|
||||
if (x === null) {
|
||||
@@ -61,8 +64,9 @@ fun box(): String {
|
||||
// x.hashCode()
|
||||
// x.toString()
|
||||
// x.test()
|
||||
x?.test2()
|
||||
x.test2()
|
||||
// Error, resolved to extension on stub receiver
|
||||
// x?.test2()
|
||||
// x.test2()
|
||||
}
|
||||
|
||||
""
|
||||
|
||||
Reference in New Issue
Block a user