[FIR] Don't provide receiver as value in delegated constructor call
This commit is contained in:
@@ -68,8 +68,14 @@ class ImplicitReceiverStackImpl private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override operator fun get(name: String?): ImplicitReceiverValue<*>? {
|
override operator fun get(name: String?): ImplicitReceiverValue<*>? {
|
||||||
if (name == null) return stack.lastOrNull()
|
if (name == null) {
|
||||||
return indexesPerLabel[Name.identifier(name)].lastOrNull()?.let { stack[it] }
|
return stack.lastOrNull {
|
||||||
|
it !is ImplicitDispatchReceiverValue || !it.inDelegated
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return indexesPerLabel[Name.identifier(name)].lastOrNull()?.let { stack[it] }?.takeIf {
|
||||||
|
it !is ImplicitDispatchReceiverValue || !it.inDelegated
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun lastDispatchReceiver(): ImplicitDispatchReceiverValue? {
|
override fun lastDispatchReceiver(): ImplicitDispatchReceiverValue? {
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ internal class ExpressionReceiverValue(
|
|||||||
sealed class ImplicitReceiverValue<S : AbstractFirBasedSymbol<*>>(
|
sealed class ImplicitReceiverValue<S : AbstractFirBasedSymbol<*>>(
|
||||||
val boundSymbol: S,
|
val boundSymbol: S,
|
||||||
type: ConeKotlinType,
|
type: ConeKotlinType,
|
||||||
private val useSiteSession: FirSession,
|
protected val useSiteSession: FirSession,
|
||||||
private val scopeSession: ScopeSession
|
protected val scopeSession: ScopeSession
|
||||||
) : ReceiverValue {
|
) : ReceiverValue {
|
||||||
final override var type: ConeKotlinType = type
|
final override var type: ConeKotlinType = type
|
||||||
private set
|
private set
|
||||||
@@ -120,6 +120,7 @@ sealed class ImplicitReceiverValue<S : AbstractFirBasedSymbol<*>>(
|
|||||||
|
|
||||||
internal enum class ImplicitDispatchReceiverKind {
|
internal enum class ImplicitDispatchReceiverKind {
|
||||||
REGULAR,
|
REGULAR,
|
||||||
|
REGULAR_IN_DELEGATED,
|
||||||
COMPANION,
|
COMPANION,
|
||||||
COMPANION_FROM_SUPERTYPE
|
COMPANION_FROM_SUPERTYPE
|
||||||
}
|
}
|
||||||
@@ -138,6 +139,11 @@ class ImplicitDispatchReceiverValue internal constructor(
|
|||||||
useSiteSession, scopeSession, kind
|
useSiteSession, scopeSession, kind
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun copyForDelegated(): ImplicitDispatchReceiverValue =
|
||||||
|
ImplicitDispatchReceiverValue(boundSymbol, type, useSiteSession, scopeSession, ImplicitDispatchReceiverKind.REGULAR_IN_DELEGATED)
|
||||||
|
|
||||||
|
val inDelegated: Boolean get() = kind == ImplicitDispatchReceiverKind.REGULAR_IN_DELEGATED
|
||||||
|
|
||||||
val implicitCompanion: Boolean get() = kind != ImplicitDispatchReceiverKind.REGULAR
|
val implicitCompanion: Boolean get() = kind != ImplicitDispatchReceiverKind.REGULAR
|
||||||
|
|
||||||
val companionFromSupertype: Boolean get() = kind == ImplicitDispatchReceiverKind.COMPANION_FROM_SUPERTYPE
|
val companionFromSupertype: Boolean get() = kind == ImplicitDispatchReceiverKind.COMPANION_FROM_SUPERTYPE
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class FirTowerResolver(
|
|||||||
if (!it.implicitCompanion && klass?.isCompanion == true) {
|
if (!it.implicitCompanion && klass?.isCompanion == true) {
|
||||||
explicitCompanions += klass.symbol
|
explicitCompanions += klass.symbol
|
||||||
}
|
}
|
||||||
if (firstDispatchValue) {
|
if (firstDispatchValue && !it.inDelegated) {
|
||||||
if (!it.implicitCompanion &&
|
if (!it.implicitCompanion &&
|
||||||
klass?.isInner == false &&
|
klass?.isInner == false &&
|
||||||
!symbol.classId.isLocal
|
!symbol.classId.isLocal
|
||||||
@@ -69,7 +69,7 @@ class FirTowerResolver(
|
|||||||
}
|
}
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
symbol.fir.classKind == ClassKind.OBJECT
|
symbol.fir.classKind == ClassKind.OBJECT && !it.inDelegated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-9
@@ -594,13 +594,23 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) :
|
|||||||
var callCompleted = true
|
var callCompleted = true
|
||||||
var result = delegatedConstructorCall
|
var result = delegatedConstructorCall
|
||||||
try {
|
try {
|
||||||
|
val lastDispatchReceiver = implicitReceiverStack.lastDispatchReceiver()
|
||||||
|
val name = lastDispatchReceiver?.boundSymbol?.classId?.shortClassName
|
||||||
|
if (lastDispatchReceiver != null) {
|
||||||
|
context.implicitReceiverStack.pop(name)
|
||||||
|
context.implicitReceiverStack.add(name, lastDispatchReceiver.copyForDelegated())
|
||||||
|
}
|
||||||
delegatedConstructorCall.transformChildren(transformer, ResolutionMode.ContextDependent)
|
delegatedConstructorCall.transformChildren(transformer, ResolutionMode.ContextDependent)
|
||||||
|
if (lastDispatchReceiver != null) {
|
||||||
|
context.implicitReceiverStack.pop(name)
|
||||||
|
context.implicitReceiverStack.add(name, lastDispatchReceiver)
|
||||||
|
}
|
||||||
val typeArguments: List<FirTypeProjection>
|
val typeArguments: List<FirTypeProjection>
|
||||||
val symbol: FirClassSymbol<*> = when (val reference = delegatedConstructorCall.calleeReference) {
|
val symbol: FirClassSymbol<*> = when (val reference = delegatedConstructorCall.calleeReference) {
|
||||||
is FirThisReference -> {
|
is FirThisReference -> {
|
||||||
typeArguments = emptyList()
|
typeArguments = emptyList()
|
||||||
if (reference.boundSymbol == null) {
|
if (reference.boundSymbol == null) {
|
||||||
implicitReceiverStack.lastDispatchReceiver()?.boundSymbol?.also {
|
lastDispatchReceiver?.boundSymbol?.also {
|
||||||
reference.replaceBoundSymbol(it)
|
reference.replaceBoundSymbol(it)
|
||||||
} ?: return delegatedConstructorCall.compose()
|
} ?: return delegatedConstructorCall.compose()
|
||||||
} else {
|
} else {
|
||||||
@@ -611,15 +621,15 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) :
|
|||||||
// TODO: unresolved supertype
|
// TODO: unresolved supertype
|
||||||
val supertype = reference.superTypeRef.coneTypeSafe<ConeClassLikeType>() ?: return delegatedConstructorCall.compose()
|
val supertype = reference.superTypeRef.coneTypeSafe<ConeClassLikeType>() ?: return delegatedConstructorCall.compose()
|
||||||
val expandedSupertype = supertype.fullyExpandedType(session)
|
val expandedSupertype = supertype.fullyExpandedType(session)
|
||||||
val symbol =
|
val symbol =
|
||||||
expandedSupertype.lookupTag.toSymbol(session) as? FirClassSymbol<*> ?: return delegatedConstructorCall.compose()
|
expandedSupertype.lookupTag.toSymbol(session) as? FirClassSymbol<*> ?: return delegatedConstructorCall.compose()
|
||||||
val classTypeParametersCount = (symbol.fir as? FirTypeParametersOwner)?.typeParameters?.size ?: 0
|
val classTypeParametersCount = (symbol.fir as? FirTypeParametersOwner)?.typeParameters?.size ?: 0
|
||||||
typeArguments = expandedSupertype.typeArguments
|
typeArguments = expandedSupertype.typeArguments
|
||||||
.takeLast(classTypeParametersCount) // Hack for KT-37525
|
.takeLast(classTypeParametersCount) // Hack for KT-37525
|
||||||
.takeIf { it.isNotEmpty() }
|
.takeIf { it.isNotEmpty() }
|
||||||
?.map { it.toFirTypeProjection() }
|
?.map { it.toFirTypeProjection() }
|
||||||
?: emptyList()
|
?: emptyList()
|
||||||
symbol
|
symbol
|
||||||
}
|
}
|
||||||
else -> return delegatedConstructorCall.compose()
|
else -> return delegatedConstructorCall.compose()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class B () {}
|
class B () {}
|
||||||
|
|
||||||
open class A(val b : B) {
|
open class A(val b : B) {
|
||||||
|
|||||||
Vendored
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class Base(val callback: () -> String)
|
open class Base(val callback: () -> String)
|
||||||
|
|
||||||
class Outer {
|
class Outer {
|
||||||
|
|||||||
compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda2.kt
Vendored
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class Base(val callback: () -> String)
|
open class Base(val callback: () -> String)
|
||||||
|
|
||||||
class Outer {
|
class Outer {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class Outer(val fn: (() -> String)?) {
|
open class Outer(val fn: (() -> String)?) {
|
||||||
companion object {
|
companion object {
|
||||||
val ok = "OK"
|
val ok = "OK"
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun WithCompanion.test(): String {
|
fun WithCompanion.test(): String {
|
||||||
object : WithCompanion(this) {}
|
object : WithCompanion(this) {}
|
||||||
return "OK"
|
return "OK"
|
||||||
|
|||||||
Vendored
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
abstract class Base(val fn: () -> String)
|
abstract class Base(val fn: () -> String)
|
||||||
|
|
||||||
object Test : Base(run { { Test.ok() } }) {
|
object Test : Base(run { { Test.ok() } }) {
|
||||||
|
|||||||
-2
@@ -1,5 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
open class Base(val s: String)
|
open class Base(val s: String)
|
||||||
|
|
||||||
object Host {
|
object Host {
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ class B : A {
|
|||||||
override fun f() {}
|
override fun f() {}
|
||||||
class C : A by this {}
|
class C : A by this {}
|
||||||
class D(val x : B = this)
|
class D(val x : B = this)
|
||||||
class E : <!INAPPLICABLE_CANDIDATE!>P<!>(this)
|
class E : P(this)
|
||||||
}
|
}
|
||||||
@@ -37,8 +37,8 @@ class A(
|
|||||||
Companion.CONST,
|
Companion.CONST,
|
||||||
Nested.CONST,
|
Nested.CONST,
|
||||||
Interface.CONST,
|
Interface.CONST,
|
||||||
a,
|
<!UNRESOLVED_REFERENCE!>a<!>,
|
||||||
b()
|
<!UNRESOLVED_REFERENCE!>b<!>()
|
||||||
)
|
)
|
||||||
|
|
||||||
class Nested {
|
class Nested {
|
||||||
|
|||||||
Vendored
-8
@@ -1,8 +0,0 @@
|
|||||||
open class S(val a: Any, val b: Any, val c: Any) {}
|
|
||||||
|
|
||||||
object A : S(prop1, prop2, func()) {
|
|
||||||
val prop1 = 1
|
|
||||||
val prop2: Int
|
|
||||||
get() = 1
|
|
||||||
fun func() {}
|
|
||||||
}
|
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
open class S(val a: Any, val b: Any, val c: Any) {}
|
open class S(val a: Any, val b: Any, val c: Any) {}
|
||||||
|
|
||||||
object A : S(<!UNRESOLVED_REFERENCE!>prop1<!>, <!UNRESOLVED_REFERENCE!>prop2<!>, <!UNRESOLVED_REFERENCE!>func<!>()) {
|
object A : S(<!UNRESOLVED_REFERENCE!>prop1<!>, <!UNRESOLVED_REFERENCE!>prop2<!>, <!UNRESOLVED_REFERENCE!>func<!>()) {
|
||||||
|
|||||||
+2
-2
@@ -20,8 +20,8 @@ class A : S (
|
|||||||
Companion.CONST,
|
Companion.CONST,
|
||||||
Nested.CONST,
|
Nested.CONST,
|
||||||
Interface.CONST,
|
Interface.CONST,
|
||||||
a,
|
<!UNRESOLVED_REFERENCE!>a<!>,
|
||||||
b()
|
<!UNRESOLVED_REFERENCE!>b<!>()
|
||||||
) {
|
) {
|
||||||
|
|
||||||
class Nested {
|
class Nested {
|
||||||
|
|||||||
+2
-2
@@ -22,8 +22,8 @@ class A : S {
|
|||||||
Companion.CONST,
|
Companion.CONST,
|
||||||
Nested.CONST,
|
Nested.CONST,
|
||||||
Interface.CONST,
|
Interface.CONST,
|
||||||
a,
|
<!UNRESOLVED_REFERENCE!>a<!>,
|
||||||
b()
|
<!UNRESOLVED_REFERENCE!>b<!>()
|
||||||
)
|
)
|
||||||
|
|
||||||
class Nested {
|
class Nested {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.HashMap
|
|||||||
|
|
||||||
//KT-250 Incorrect variable resolve in constructor arguments of superclass
|
//KT-250 Incorrect variable resolve in constructor arguments of superclass
|
||||||
open class A(val x: Int)
|
open class A(val x: Int)
|
||||||
class B(y: Int) : A(x) //x is resolved as a property in a, so no error is generated
|
class B(y: Int) : A(<!UNRESOLVED_REFERENCE!>x<!>) //x is resolved as a property in a, so no error is generated
|
||||||
|
|
||||||
//KT-617 Prohibit dollars in call to superclass constructors
|
//KT-617 Prohibit dollars in call to superclass constructors
|
||||||
open class M(p: Int)
|
open class M(p: Int)
|
||||||
@@ -29,9 +29,9 @@ abstract class TagWithText(name : String) : Tag(name) {
|
|||||||
open class BodyTag(name : String) : TagWithText(name) {
|
open class BodyTag(name : String) : TagWithText(name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Body() : BodyTag(name) { // Must be an error!
|
class Body() : BodyTag(<!UNRESOLVED_REFERENCE!>name<!>) { // Must be an error!
|
||||||
}
|
}
|
||||||
class Body1() : BodyTag(this.name) { // Must be an error!
|
class Body1() : BodyTag(this.<!UNRESOLVED_REFERENCE!>name<!>) { // Must be an error!
|
||||||
}
|
}
|
||||||
|
|
||||||
//more tests
|
//more tests
|
||||||
@@ -40,10 +40,10 @@ open class X(p: Int, r: Int) {
|
|||||||
val s = "s"
|
val s = "s"
|
||||||
}
|
}
|
||||||
|
|
||||||
class Y(i: Int) : X(i, rrr) {
|
class Y(i: Int) : X(i, <!UNRESOLVED_REFERENCE!>rrr<!>) {
|
||||||
val rrr = 3
|
val rrr = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
class Z(val i: Int) : <!INAPPLICABLE_CANDIDATE!>X<!>(s, x) {
|
class Z(val i: Int) : X(<!UNRESOLVED_REFERENCE!>s<!>, <!UNRESOLVED_REFERENCE!>x<!>) {
|
||||||
val x = 2
|
val x = 2
|
||||||
}
|
}
|
||||||
+1
-1
@@ -6,7 +6,7 @@ open class Base<T>(p: Any?) {
|
|||||||
|
|
||||||
class D: Base<Int>("") {
|
class D: Base<Int>("") {
|
||||||
inner class B : Base<String> {
|
inner class B : Base<String> {
|
||||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(""))
|
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(<!INAPPLICABLE_CANDIDATE!>foo1<!>(""))
|
||||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ open class Base<T>(p: Any?) {
|
|||||||
class D: Base<Int>(1) {
|
class D: Base<Int>(1) {
|
||||||
inner class B : Base<Int> {
|
inner class B : Base<Int> {
|
||||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
||||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.foo1(1))
|
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>(1))
|
||||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@D.foo1(1))
|
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@D.foo1(1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -7,6 +7,6 @@ fun Base.foo() {
|
|||||||
class B : Base {
|
class B : Base {
|
||||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1())
|
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1())
|
||||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@foo.foo1())
|
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@foo.foo1())
|
||||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.foo1())
|
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -5,9 +5,9 @@ open class Base<T>(p: Any?) {
|
|||||||
|
|
||||||
fun Base<Int>.foo() {
|
fun Base<Int>.foo() {
|
||||||
class B : Base<String> {
|
class B : Base<String> {
|
||||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(""))
|
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(<!INAPPLICABLE_CANDIDATE!>foo1<!>(""))
|
||||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
||||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@foo.foo1(12))
|
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@foo.foo1(12))
|
||||||
constructor(x: Int, y: Int, z: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.foo1(""))
|
constructor(x: Int, y: Int, z: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>(""))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -7,5 +7,5 @@ class Outer {
|
|||||||
|
|
||||||
constructor(x: Int)
|
constructor(x: Int)
|
||||||
constructor(x: Int, y: Int, z: Int = x + Inner().prop + this.Inner().prop) :
|
constructor(x: Int, y: Int, z: Int = x + Inner().prop + this.Inner().prop) :
|
||||||
this(x + Inner().prop + this.Inner().prop)
|
this(x + Inner().prop <!AMBIGUITY!>+<!> this.<!UNRESOLVED_REFERENCE!>Inner<!>().<!UNRESOLVED_REFERENCE!>prop<!>)
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+4
-4
@@ -7,9 +7,9 @@ class A {
|
|||||||
constructor(x: () -> Int)
|
constructor(x: () -> Int)
|
||||||
constructor() : this(
|
constructor() : this(
|
||||||
{
|
{
|
||||||
foo() +
|
<!UNRESOLVED_REFERENCE!>foo<!>() +
|
||||||
this.foo() +
|
this.<!UNRESOLVED_REFERENCE!>foo<!>() +
|
||||||
this@A.foo() +
|
this@A.<!UNRESOLVED_REFERENCE!>foo<!>() +
|
||||||
foobar()
|
<!UNRESOLVED_REFERENCE!>foobar<!>()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -3,5 +3,5 @@ class A {
|
|||||||
fun foo() = 1
|
fun foo() = 1
|
||||||
constructor(x: Int)
|
constructor(x: Int)
|
||||||
constructor(x: Int, y: Int, z: Int = x + foo() + this.foo()) :
|
constructor(x: Int, y: Int, z: Int = x + foo() + this.foo()) :
|
||||||
this(x + foo() + this.foo())
|
<!INAPPLICABLE_CANDIDATE!>this<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>())
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@ class A {
|
|||||||
fun foo() = 1
|
fun foo() = 1
|
||||||
constructor(x: Any?)
|
constructor(x: Any?)
|
||||||
constructor() : this(object {
|
constructor() : this(object {
|
||||||
fun bar() = foo() + this@A.foo() +
|
fun bar() = <!UNRESOLVED_REFERENCE!>foo<!>() + this@A.<!UNRESOLVED_REFERENCE!>foo<!>() +
|
||||||
foobar() + super@A.hashCode()
|
<!INAPPLICABLE_CANDIDATE!>foobar<!>() + super@A.hashCode()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -4,8 +4,8 @@ class D : C {
|
|||||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(
|
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(
|
||||||
{
|
{
|
||||||
val s = ""
|
val s = ""
|
||||||
s()
|
<!UNRESOLVED_REFERENCE!>s<!>()
|
||||||
""()
|
<!UNRESOLVED_REFERENCE!>""()<!>
|
||||||
42
|
42
|
||||||
}())
|
}())
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -3,5 +3,5 @@ class A {
|
|||||||
val prop = 1
|
val prop = 1
|
||||||
constructor(x: Int)
|
constructor(x: Int)
|
||||||
constructor(x: Int, y: Int, z: Int = x + prop + this.prop) :
|
constructor(x: Int, y: Int, z: Int = x + prop + this.prop) :
|
||||||
this(x + prop + this.prop)
|
<!INAPPLICABLE_CANDIDATE!>this<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!>)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -3,5 +3,5 @@ open class B(x: Int)
|
|||||||
class A : B {
|
class A : B {
|
||||||
val prop = 1
|
val prop = 1
|
||||||
constructor(x: Int, y: Int = x + prop + this.prop) :
|
constructor(x: Int, y: Int = x + prop + this.prop) :
|
||||||
<!INAPPLICABLE_CANDIDATE!>super<!>(x + prop + this.prop)
|
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!>)
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -4,5 +4,5 @@ open class B(x: Int) {
|
|||||||
}
|
}
|
||||||
class A : B {
|
class A : B {
|
||||||
constructor(x: Int, y: Int = x + foo() + this.foo() + super.foo()) :
|
constructor(x: Int, y: Int = x + foo() + this.foo() + super.foo()) :
|
||||||
<!INAPPLICABLE_CANDIDATE!>super<!>(x + foo() + this.foo() + super.foo())
|
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>() + super.foo())
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -5,5 +5,5 @@ open class B(x: Int) {
|
|||||||
class A : B {
|
class A : B {
|
||||||
override fun foo() = 2
|
override fun foo() = 2
|
||||||
constructor(x: Int, y: Int = x + foo() + this.foo() + super.foo()) :
|
constructor(x: Int, y: Int = x + foo() + this.foo() + super.foo()) :
|
||||||
<!INAPPLICABLE_CANDIDATE!>super<!>(x + foo() + this.foo() + super.foo())
|
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + this.<!UNRESOLVED_REFERENCE!>foo<!>() + super.foo())
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,5 +2,5 @@
|
|||||||
open class B(val prop: Int)
|
open class B(val prop: Int)
|
||||||
class A : B {
|
class A : B {
|
||||||
constructor(x: Int, y: Int = x + prop + this.prop + super.prop) :
|
constructor(x: Int, y: Int = x + prop + this.prop + super.prop) :
|
||||||
<!INAPPLICABLE_CANDIDATE!>super<!>(x + prop + this.prop + super.prop)
|
<!INAPPLICABLE_CANDIDATE!>super<!>(x <!AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + this.<!UNRESOLVED_REFERENCE!>prop<!> + super.prop)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -5,10 +5,10 @@ val A.prop: Int get() = 2
|
|||||||
|
|
||||||
class A {
|
class A {
|
||||||
constructor(x: Int)
|
constructor(x: Int)
|
||||||
constructor() : this(
|
constructor() : <!INAPPLICABLE_CANDIDATE!>this<!>(
|
||||||
foobar() +
|
<!UNRESOLVED_REFERENCE!>foobar<!>() +
|
||||||
this.foobar() +
|
this.foobar() +
|
||||||
prop +
|
<!UNRESOLVED_REFERENCE!>prop<!> +
|
||||||
this.prop +
|
this.prop +
|
||||||
this@A.prop
|
this@A.prop
|
||||||
)
|
)
|
||||||
|
|||||||
Vendored
+1
-1
@@ -41,7 +41,7 @@ FILE fqName:<root> fileName:/thisRefToObjectInNestedClassConstructorCall.kt
|
|||||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Host.Derived1 [primary]
|
CONSTRUCTOR visibility:public <> () returnType:<root>.Host.Derived1 [primary]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.Any) [primary] declared in <root>.Base'
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.Any) [primary] declared in <root>.Base'
|
||||||
x: GET_VAR '<this>: <root>.Host.Derived1 declared in <root>.Host.Derived1' type=<root>.Host.Derived1 origin=null
|
x: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived1 modality:FINAL visibility:public superTypes:[<root>.Base]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived1 modality:FINAL visibility:public superTypes:[<root>.Base]'
|
||||||
PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val]
|
PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val]
|
||||||
FUN FAKE_OVERRIDE name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Host.Derived1) returnType:kotlin.Any [fake_override]
|
FUN FAKE_OVERRIDE name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Host.Derived1) returnType:kotlin.Any [fake_override]
|
||||||
|
|||||||
+4
-2
@@ -8,7 +8,8 @@ FILE fqName:<root> fileName:/thisReferenceBeforeClassDeclared.kt
|
|||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.test.<no name provided>
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.test.<no name provided>
|
||||||
CONSTRUCTOR visibility:private <> () returnType:<root>.test.<no name provided> [primary]
|
CONSTRUCTOR visibility:private <> () returnType:<root>.test.<no name provided> [primary]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
ERROR_CALL 'Cannot find delegated constructor call' type=<root>.WithCompanion
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (a: <root>.WithCompanion.Companion) [primary] declared in <root>.WithCompanion'
|
||||||
|
a: GET_OBJECT 'CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]' type=<root>.WithCompanion.Companion
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.WithCompanion]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.WithCompanion]'
|
||||||
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test.<no name provided>' type=<root>.test.<no name provided> origin=OBJECT_LITERAL
|
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test.<no name provided>' type=<root>.test.<no name provided> origin=OBJECT_LITERAL
|
||||||
VAR name:test2 type:<root>.test.<no name provided> [val]
|
VAR name:test2 type:<root>.test.<no name provided> [val]
|
||||||
@@ -18,7 +19,8 @@ FILE fqName:<root> fileName:/thisReferenceBeforeClassDeclared.kt
|
|||||||
CONSTRUCTOR visibility:private <> () returnType:<root>.test.<no name provided> [primary]
|
CONSTRUCTOR visibility:private <> () returnType:<root>.test.<no name provided> [primary]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (a: <root>.WithCompanion.Companion) [primary] declared in <root>.WithCompanion'
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (a: <root>.WithCompanion.Companion) [primary] declared in <root>.WithCompanion'
|
||||||
a: ERROR_CALL 'Unresolved reference: <Unresolved name: foo>#' type=IrErrorType
|
a: CALL 'public final fun foo (): <root>.WithCompanion.Companion declared in <root>.WithCompanion.Companion' type=<root>.WithCompanion.Companion origin=null
|
||||||
|
$this: GET_OBJECT 'CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]' type=<root>.WithCompanion.Companion
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.WithCompanion]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.WithCompanion]'
|
||||||
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test.<no name provided>' type=<root>.test.<no name provided> origin=OBJECT_LITERAL
|
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test.<no name provided>' type=<root>.test.<no name provided> origin=OBJECT_LITERAL
|
||||||
CLASS CLASS name:WithCompanion modality:OPEN visibility:public superTypes:[kotlin.Any]
|
CLASS CLASS name:WithCompanion modality:OPEN visibility:public superTypes:[kotlin.Any]
|
||||||
|
|||||||
Reference in New Issue
Block a user