Do not try to detect cycles if delegation call resolution is unsuccessful
This commit is contained in:
@@ -229,7 +229,7 @@ public class BodyResolver {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private ConstructorDescriptor getDelegatedConstructor(@NotNull ConstructorDescriptor constructor) {
|
private ConstructorDescriptor getDelegatedConstructor(@NotNull ConstructorDescriptor constructor) {
|
||||||
ResolvedCall<ConstructorDescriptor> call = trace.get(CONSTRUCTOR_RESOLVED_DELEGATION_CALL, constructor);
|
ResolvedCall<ConstructorDescriptor> call = trace.get(CONSTRUCTOR_RESOLVED_DELEGATION_CALL, constructor);
|
||||||
return call == null ? null : call.getResultingDescriptor().getOriginal();
|
return call == null || !call.getStatus().isSuccess() ? null : call.getResultingDescriptor().getOriginal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resolveBodies(@NotNull BodiesResolveContext c) {
|
public void resolveBodies(@NotNull BodiesResolveContext c) {
|
||||||
|
|||||||
@@ -17,5 +17,5 @@ class A1<R> : B<R> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class A2<R> {
|
class A2<R> {
|
||||||
constructor(t: R, i: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(<!TYPE_MISMATCH!>i<!>, 1)
|
constructor(t: R, i: Int) : this(<!TYPE_MISMATCH!>i<!>, 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
class X<T> {
|
class X<T> {
|
||||||
constructor(t: T, i: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(<!TYPE_MISMATCH!>i<!>, 1)
|
constructor(t: T, i: Int): this(<!TYPE_MISMATCH!>i<!>, 1)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user