[FE 1.0] Don't throw exception during substitution of accessors, just return original
This commit is contained in:
committed by
teamcity
parent
db54d18c72
commit
00d1e46c5a
+6
@@ -14393,6 +14393,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/labaledCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertySubstitution.kt")
|
||||
public void testPropertySubstitution() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/propertySubstitution.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
|
||||
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
|
||||
|
||||
+6
@@ -14393,6 +14393,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/labaledCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertySubstitution.kt")
|
||||
public void testPropertySubstitution() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/propertySubstitution.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
|
||||
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
|
||||
|
||||
+6
@@ -14393,6 +14393,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/labaledCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertySubstitution.kt")
|
||||
public void testPropertySubstitution() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/propertySubstitution.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
|
||||
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
|
||||
|
||||
Generated
+6
@@ -3012,6 +3012,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullWithIntersection1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontLeaveStubTypesInSetter.kt")
|
||||
public void testDontLeaveStubTypesInSetter() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/dontLeaveStubTypesInSetter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericDelegatedDeepProperty.kt")
|
||||
public void testGenericDelegatedDeepProperty() throws Exception {
|
||||
|
||||
+6
@@ -3012,6 +3012,12 @@ public class LightTreeFir2IrTextTestGenerated extends AbstractLightTreeFir2IrTex
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullWithIntersection1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontLeaveStubTypesInSetter.kt")
|
||||
public void testDontLeaveStubTypesInSetter() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/dontLeaveStubTypesInSetter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericDelegatedDeepProperty.kt")
|
||||
public void testGenericDelegatedDeepProperty() throws Exception {
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
|
||||
interface FirJavaClass2 {
|
||||
val superTypeRefs: MutableList<FirTypeRef2>
|
||||
}
|
||||
|
||||
interface ConeKotlinType2
|
||||
|
||||
class ClassId2
|
||||
|
||||
val ConeKotlinType2.classId: ClassId2? get() = null
|
||||
|
||||
interface FirSignatureEnhancement2 {
|
||||
fun enhanceSuperType(type: FirTypeRef2): FirTypeRef2 = TODO()
|
||||
}
|
||||
|
||||
interface FirTypeRef2
|
||||
|
||||
val FirTypeRef2.coneType: ConeKotlinType2 get() = TODO()
|
||||
|
||||
private fun FirJavaClass2.getPurelyImplementedSupertype(): ConeKotlinType2? = null
|
||||
|
||||
inline fun buildResolvedTypeRef2(init: FirResolvedTypeRefBuilder2.() -> Unit): FirResolvedTypeRef2 = TODO()
|
||||
|
||||
interface FirResolvedTypeRef2 : FirTypeRef2
|
||||
|
||||
class FirResolvedTypeRefBuilder2 {
|
||||
lateinit var type: ConeKotlinType2
|
||||
}
|
||||
|
||||
fun foo(firJavaClass: FirJavaClass2, enhancement: FirSignatureEnhancement2) {
|
||||
val enhancedSuperTypes = buildList {
|
||||
val purelyImplementedSupertype = firJavaClass.getPurelyImplementedSupertype()
|
||||
val purelyImplementedSupertypeClassId = purelyImplementedSupertype?.classId
|
||||
firJavaClass.superTypeRefs.mapNotNullTo(this) { superType ->
|
||||
enhancement.enhanceSuperType(superType).takeUnless {
|
||||
purelyImplementedSupertypeClassId != null && it.coneType.classId == purelyImplementedSupertypeClassId
|
||||
}
|
||||
}
|
||||
purelyImplementedSupertype?.let {
|
||||
add(buildResolvedTypeRef2 { type = it })
|
||||
}
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package
|
||||
|
||||
public val ConeKotlinType2.classId: ClassId2?
|
||||
public val FirTypeRef2.coneType: ConeKotlinType2
|
||||
public inline fun buildResolvedTypeRef2(/*0*/ init: FirResolvedTypeRefBuilder2.() -> kotlin.Unit): FirResolvedTypeRef2
|
||||
public fun foo(/*0*/ firJavaClass: FirJavaClass2, /*1*/ enhancement: FirSignatureEnhancement2): kotlin.Unit
|
||||
private fun FirJavaClass2.getPurelyImplementedSupertype(): ConeKotlinType2?
|
||||
|
||||
public final class ClassId2 {
|
||||
public constructor ClassId2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface ConeKotlinType2 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface FirJavaClass2 {
|
||||
public abstract val superTypeRefs: kotlin.collections.MutableList<FirTypeRef2>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface FirResolvedTypeRef2 : FirTypeRef2 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class FirResolvedTypeRefBuilder2 {
|
||||
public constructor FirResolvedTypeRefBuilder2()
|
||||
public final lateinit var type: ConeKotlinType2
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface FirSignatureEnhancement2 {
|
||||
public open fun enhanceSuperType(/*0*/ type: FirTypeRef2): FirTypeRef2
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface FirTypeRef2 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
FILE fqName:<root> fileName:/dontLeaveStubTypesInSetter.kt
|
||||
CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Foo<T of <root>.Foo>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
CONSTRUCTOR visibility:public <> (x:T of <root>.Foo) returnType:<root>.Foo<T of <root>.Foo> [primary]
|
||||
VALUE_PARAMETER name:x index:0 type:T of <root>.Foo
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:x visibility:public modality:FINAL [var]
|
||||
FIELD PROPERTY_BACKING_FIELD name:x type:T of <root>.Foo visibility:private
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'x: T of <root>.Foo declared in <root>.Foo.<init>' type=T of <root>.Foo origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Foo<T of <root>.Foo>) returnType:T of <root>.Foo
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Foo<T of <root>.Foo>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-x> (): T of <root>.Foo declared in <root>.Foo'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of <root>.Foo visibility:private' type=T of <root>.Foo origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Foo<T of <root>.Foo> declared in <root>.Foo.<get-x>' type=<root>.Foo<T of <root>.Foo> origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-x> visibility:public modality:FINAL <> ($this:<root>.Foo<T of <root>.Foo>, <set-?>:T of <root>.Foo) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Foo<T of <root>.Foo>
|
||||
VALUE_PARAMETER name:<set-?> index:0 type:T of <root>.Foo
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of <root>.Foo visibility:private' type=kotlin.Unit origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Foo<T of <root>.Foo> declared in <root>.Foo.<set-x>' type=<root>.Foo<T of <root>.Foo> origin=null
|
||||
value: GET_VAR '<set-?>: T of <root>.Foo declared in <root>.Foo.<set-x>' type=T of <root>.Foo origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:foo visibility:public modality:FINAL <K> (x:kotlin.collections.MutableList<K of <root>.foo>) returnType:<root>.Foo<K of <root>.foo>
|
||||
TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.collections.MutableList<K of <root>.foo>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun foo <K> (x: kotlin.collections.MutableList<K of <root>.foo>): <root>.Foo<K of <root>.foo> declared in <root>'
|
||||
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin.StandardKt' type=kotlin.Nothing origin=null
|
||||
FUN name:main visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:x type:kotlin.collections.List<kotlin.String> [val]
|
||||
CALL 'public final fun buildList <E> (builderAction: @[ExtensionFunctionType] kotlin.Function1<kotlin.collections.MutableList<E of kotlin.collections.CollectionsKt.buildList>, kotlin.Unit>): kotlin.collections.List<E of kotlin.collections.CollectionsKt.buildList> [inline] declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List<kotlin.String> origin=null
|
||||
<E>: kotlin.String
|
||||
builderAction: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<kotlin.collections.MutableList<kotlin.String>, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:kotlin.collections.MutableList<kotlin.String>) returnType:kotlin.Unit
|
||||
$receiver: VALUE_PARAMETER name:$this$buildList type:kotlin.collections.MutableList<kotlin.String>
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CALL 'public abstract fun add (element: E of kotlin.collections.MutableList): kotlin.Boolean declared in kotlin.collections.MutableList' type=kotlin.Boolean origin=null
|
||||
$this: GET_VAR '$this$buildList: kotlin.collections.MutableList<kotlin.String> declared in <root>.main.<anonymous>' type=kotlin.collections.MutableList<kotlin.String> origin=null
|
||||
element: CONST String type=kotlin.String value=""
|
||||
VAR name:foo type:<root>.Foo<kotlin.String> [val]
|
||||
CALL 'public final fun foo <K> (x: kotlin.collections.MutableList<K of <root>.foo>): <root>.Foo<K of <root>.foo> declared in <root>' type=<root>.Foo<kotlin.String> origin=null
|
||||
<K>: kotlin.String
|
||||
x: GET_VAR '$this$buildList: kotlin.collections.MutableList<kotlin.String> declared in <root>.main.<anonymous>' type=kotlin.collections.MutableList<kotlin.String> origin=null
|
||||
CALL 'public final fun <set-x> (<set-?>: T of <root>.Foo): kotlin.Unit declared in <root>.Foo' type=kotlin.Unit origin=EQ
|
||||
$this: GET_VAR 'val foo: <root>.Foo<kotlin.String> [val] declared in <root>.main.<anonymous>' type=<root>.Foo<kotlin.String> origin=null
|
||||
<set-?>: CONST String type=kotlin.String value=""
|
||||
@@ -0,0 +1,14 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
|
||||
class Foo<T>(var x: T)
|
||||
|
||||
fun <K> foo(x: MutableList<K>): Foo<K> = TODO()
|
||||
|
||||
fun main() {
|
||||
val x = buildList {
|
||||
add("")
|
||||
val foo = foo(this)
|
||||
foo.x = ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
class Foo<T : Any?> {
|
||||
constructor(x: T) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
var x: T
|
||||
field = x
|
||||
get
|
||||
set
|
||||
|
||||
}
|
||||
|
||||
fun <K : Any?> foo(x: MutableList<K>): Foo<K> {
|
||||
return TODO()
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val x: List<String> = buildList<String>(builderAction = local fun MutableList<String>.<anonymous>() {
|
||||
$this$buildList.add(element = "") /*~> Unit */
|
||||
val foo: Foo<String> = foo<String>(x = $this$buildList)
|
||||
foo.<set-x>(<set-?> = "")
|
||||
}
|
||||
)
|
||||
}
|
||||
Generated
+6
@@ -14399,6 +14399,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/labaledCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertySubstitution.kt")
|
||||
public void testPropertySubstitution() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/propertySubstitution.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
|
||||
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
|
||||
|
||||
Generated
+6
@@ -3012,6 +3012,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullWithIntersection1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontLeaveStubTypesInSetter.kt")
|
||||
public void testDontLeaveStubTypesInSetter() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/dontLeaveStubTypesInSetter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericDelegatedDeepProperty.kt")
|
||||
public void testGenericDelegatedDeepProperty() throws Exception {
|
||||
|
||||
@@ -2182,6 +2182,11 @@ public class KlibTextTestCaseGenerated extends AbstractKlibTextTestCase {
|
||||
runTest("compiler/testData/ir/irText/types/definitelyNotNullWithIntersection1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("dontLeaveStubTypesInSetter.kt")
|
||||
public void testDontLeaveStubTypesInSetter() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/dontLeaveStubTypesInSetter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericDelegatedDeepProperty.kt")
|
||||
public void testGenericDelegatedDeepProperty() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/genericDelegatedDeepProperty.kt");
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
||||
@NotNull
|
||||
@Override
|
||||
public FunctionDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
return this; // no substitution since we work with originals of accessors in the backend anyway
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user