[FIR] Additional errors to distinguish resolution to classifier cases

When a call is resolved to a classifier, only a single error message was
being used for multiple cases. This lead to confusion as the default
message may not be applicable to a given error case. Added additional
errors and messages to distinguish between these error cases.

#KT-57251 Fixed
This commit is contained in:
Brian Norman
2023-06-02 09:34:49 -05:00
committed by Space Team
parent ac79633590
commit 0ff9982b31
44 changed files with 582 additions and 39 deletions
@@ -0,0 +1,65 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A(
n: Nested = foo(),
n2: Nested = Nested(),
inn: Inner = null!!,
inn2: Inner = <!INNER_CLASS_CONSTRUCTOR_NO_RECEIVER!>Inner<!>(),
i: Interface = null!!,
c: Int = CONST,
cc: Int = Companion.CONST,
cn: Int = Nested.CONST,
ci: Int = Interface.CONST,
t1: Int = <!UNRESOLVED_REFERENCE!>a<!>,
t2: Int = <!UNRESOLVED_REFERENCE!>b<!>()
) {
constructor(
dummy: Int,
n: Nested = foo(),
n2: Nested = Nested(),
inn: Inner = null!!,
inn2: Inner = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>Inner<!>(),
i: Interface = null!!,
c: Int = CONST,
cc: Int = Companion.CONST,
cn: Int = Nested.CONST,
ci: Int = Interface.CONST,
t1: Int = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>a<!>,
t2: Int = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>b<!>()
) : this(
foo(),
Nested(),
inn,
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>Inner<!>(),
i,
CONST,
Companion.CONST,
Nested.CONST,
Interface.CONST,
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>a<!>,
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>b<!>()
)
class Nested {
companion object {
const val CONST = 2
}
}
inner class Inner
interface Interface {
companion object {
const val CONST = 3
}
}
val a = 1
fun b() = 2
companion object {
const val CONST = 1
fun foo(): Nested = null!!
}
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A(
@@ -0,0 +1,50 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface I
open class S(
n: A.Nested,
n2: A.Nested,
inn: A.Inner,
c: Int,
cc: Int,
cn: Int,
ci: Int,
t1: Int,
t2: Int
) : I
class A : I by S(
foo(),
Nested(),
<!INNER_CLASS_CONSTRUCTOR_NO_RECEIVER!>Inner<!>(),
CONST,
Companion.CONST,
Nested.CONST,
Interface.CONST,
<!UNRESOLVED_REFERENCE!>a<!>,
<!UNRESOLVED_REFERENCE!>b<!>()
) {
class Nested {
companion object {
const val CONST = 2
}
}
inner class Inner
interface Interface {
companion object {
const val CONST = 3
}
}
val a = 1
fun b() = 2
companion object {
const val CONST = 1
fun foo(): Nested = null!!
}
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface I
@@ -0,0 +1,48 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class S(
n: A.Nested,
n2: A.Nested,
inn: A.Inner,
c: Int,
cc: Int,
cn: Int,
ci: Int,
t1: Int,
t2: Int
)
class A : S (
foo(),
Nested(),
<!INNER_CLASS_CONSTRUCTOR_NO_RECEIVER!>Inner<!>(),
CONST,
Companion.CONST,
Nested.CONST,
Interface.CONST,
<!UNRESOLVED_REFERENCE!>a<!>,
<!UNRESOLVED_REFERENCE!>b<!>()
) {
class Nested {
companion object {
const val CONST = 2
}
}
inner class Inner
interface Interface {
companion object {
const val CONST = 3
}
}
val a = 1
fun b() = 2
companion object {
const val CONST = 1
fun foo(): Nested = null!!
}
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class S(