FIR: Rename stub type for builder inference

This commit is contained in:
Simon Ogorodnik
2021-11-26 15:51:40 +03:00
committed by teamcity
parent 1a288fcdcd
commit bb13583862
18 changed files with 30 additions and 29 deletions
@@ -42,7 +42,7 @@ FILE: delegateInference.kt
public final var x: R|kotlin/Boolean|by R|/FreezableVar.FreezableVar|<R|kotlin/Boolean|>(Boolean(true))
public get(): R|kotlin/Boolean| {
^ this@R|/Test|.D|/Test.x|.R|SubstitutionOverride</FreezableVar.getValue: R|Stub (builder inference): TypeVariable(_T)|>|(this@R|/Test|, ::R|/Test.x|)
^ this@R|/Test|.D|/Test.x|.R|SubstitutionOverride</FreezableVar.getValue: R|Stub (chain inference): TypeVariable(_T)|>|(this@R|/Test|, ::R|/Test.x|)
}
public set(<set-?>: R|kotlin/Boolean|): R|kotlin/Unit| {
this@R|/Test|.D|/Test.x|.R|SubstitutionOverride</FreezableVar.setValue: R|kotlin/Unit|>|(this@R|/Test|, ::R|/Test.x|, R|<local>/x|)
@@ -50,7 +50,7 @@ FILE: delegateInference.kt
public final var y: R|kotlin/String|by R|/FreezableVar.FreezableVar|<R|kotlin/String|>(String())
public get(): R|kotlin/String| {
^ this@R|/Test|.D|/Test.y|.R|SubstitutionOverride</FreezableVar.getValue: R|Stub (builder inference): TypeVariable(_T)|>|(this@R|/Test|, ::R|/Test.y|)
^ this@R|/Test|.D|/Test.y|.R|SubstitutionOverride</FreezableVar.getValue: R|Stub (chain inference): TypeVariable(_T)|>|(this@R|/Test|, ::R|/Test.y|)
}
public set(<set-?>: R|kotlin/String|): R|kotlin/Unit| {
this@R|/Test|.D|/Test.y|.R|SubstitutionOverride</FreezableVar.setValue: R|kotlin/Unit|>|(this@R|/Test|, ::R|/Test.y|, R|<local>/y|)
@@ -31,7 +31,7 @@ FILE: delegateWithLambda.kt
}
)
public get(): R|kotlin/String| {
^ this@R|/Test|.D|/Test.x|.R|SubstitutionOverride</LazyDelegate.getValue: R|Stub (builder inference): TypeVariable(_T)|>|(this@R|/Test|, ::R|/Test.x|)
^ this@R|/Test|.D|/Test.x|.R|SubstitutionOverride</LazyDelegate.getValue: R|Stub (chain inference): TypeVariable(_T)|>|(this@R|/Test|, ::R|/Test.x|)
}
}
@@ -38,9 +38,9 @@ FILE: provideDelegate.kt
super<R|kotlin/Any|>()
}
public final val x: R|kotlin/Int|by R|/delegate|<R|kotlin/Int|>(Int(1)).R|SubstitutionOverride</DelegateProvider.provideDelegate: R|Delegate<Stub (builder inference): TypeVariable(_T)>|>|(this@R|/A|, ::R|/A.x|)
public final val x: R|kotlin/Int|by R|/delegate|<R|kotlin/Int|>(Int(1)).R|SubstitutionOverride</DelegateProvider.provideDelegate: R|Delegate<Stub (chain inference): TypeVariable(_T)>|>|(this@R|/A|, ::R|/A.x|)
public get(): R|kotlin/Int| {
^ this@R|/A|.D|/A.x|.R|SubstitutionOverride</Delegate.getValue: R|Stub (builder inference): TypeVariable(_T)|>|(this@R|/A|, ::R|/A.x|)
^ this@R|/A|.D|/A.x|.R|SubstitutionOverride</Delegate.getValue: R|Stub (chain inference): TypeVariable(_T)|>|(this@R|/A|, ::R|/A.x|)
}
}
@@ -29,9 +29,9 @@ FILE: receiverInference.kt
super<R|kotlin/Any|>()
}
public final val d: R|kotlin/String|by R|/mkProp|<R|MyEnt|, R|kotlin/String|>().R|SubstitutionOverride</Provider.provideDelegate: R|Prop<Stub (builder inference): TypeVariable(_R), Stub (builder inference): TypeVariable(_V)>|>|(this@R|/MyEnt|, ::R|/MyEnt.d|)
public final val d: R|kotlin/String|by R|/mkProp|<R|MyEnt|, R|kotlin/String|>().R|SubstitutionOverride</Provider.provideDelegate: R|Prop<Stub (chain inference): TypeVariable(_R), Stub (chain inference): TypeVariable(_V)>|>|(this@R|/MyEnt|, ::R|/MyEnt.d|)
public get(): R|kotlin/String| {
^ this@R|/MyEnt|.D|/MyEnt.d|.R|SubstitutionOverride</Prop.getValue: R|Stub (builder inference): TypeVariable(_V)|>|(this@R|/MyEnt|, ::R|/MyEnt.d|)
^ this@R|/MyEnt|.D|/MyEnt.d|.R|SubstitutionOverride</Prop.getValue: R|Stub (chain inference): TypeVariable(_V)|>|(this@R|/MyEnt|, ::R|/MyEnt.d|)
}
}
@@ -35,7 +35,7 @@ FILE: delegateTypeMismatch.kt
public final var classifierNamePolicy: R|ClassifierNamePolicy|by this@R|/A|.R|/A.property|<R|ClassifierNamePolicy|>(Q|ClassifierNamePolicy.SOURCE_CODE_QUALIFIED|)
public get(): R|ClassifierNamePolicy| {
^ this@R|/A|.D|/A.classifierNamePolicy|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|Stub (builder inference): TypeVariable(_T)|>|(this@R|/A|, ::R|/A.classifierNamePolicy|)
^ this@R|/A|.D|/A.classifierNamePolicy|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|Stub (chain inference): TypeVariable(_T)|>|(this@R|/A|, ::R|/A.classifierNamePolicy|)
}
public set(<set-?>: R|ClassifierNamePolicy|): R|kotlin/Unit| {
this@R|/A|.D|/A.classifierNamePolicy|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/A|, ::R|/A.classifierNamePolicy|, R|<local>/classifierNamePolicy|)
@@ -178,8 +178,8 @@ digraph delegateWithAnonymousObject_kt {
55 [label="Enter block"];
56 [label="Access variable D|/IssuesListUserProfile.issueListView|"];
57 [label="Access variable this@R|/IssuesListUserProfile|"];
58 [label="Function call: this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|Stub (builder inference): TypeVariable(_Target)|>|(...)"];
59 [label="Jump: ^ this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|Stub (builder inference): TypeVariable(_Target)|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)"];
58 [label="Function call: this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|Stub (chain inference): TypeVariable(_Target)|>|(...)"];
59 [label="Jump: ^ this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|Stub (chain inference): TypeVariable(_Target)|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)"];
60 [label="Stub" style="filled" fillcolor=gray];
61 [label="Exit block" style="filled" fillcolor=gray];
}
@@ -41,7 +41,7 @@ FILE: delegateWithAnonymousObject.kt
}
)
public get(): R|IssueListView| {
^ this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|Stub (builder inference): TypeVariable(_Target)|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)
^ this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|Stub (chain inference): TypeVariable(_Target)|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)
}
public set(<set-?>: R|IssueListView|): R|kotlin/Unit| {
this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|, R|<local>/issueListView|)
@@ -25,12 +25,12 @@ FILE: kt41917.kt
public final val implicit: R|kotlin/String|by R|/DummyDelegate.DummyDelegate|<R|kotlin/String|>(String(hello))
public get(): R|kotlin/String| {
^ this@R|/A|.D|/A.implicit|.R|SubstitutionOverride</DummyDelegate.getValue: R|Stub (builder inference): TypeVariable(_V)|>|(this@R|/A|, ::R|/A.implicit|)
^ this@R|/A|.D|/A.implicit|.R|SubstitutionOverride</DummyDelegate.getValue: R|Stub (chain inference): TypeVariable(_V)|>|(this@R|/A|, ::R|/A.implicit|)
}
public final val explicit: R|kotlin/String|by R|/DummyDelegate.DummyDelegate|<R|kotlin/String|>(String(hello))
public get(): R|kotlin/String| {
^ this@R|/A|.D|/A.explicit|.R|SubstitutionOverride</DummyDelegate.getValue: R|Stub (builder inference): TypeVariable(_V)|>|(this@R|/A|, ::R|/A.explicit|)
^ this@R|/A|.D|/A.explicit|.R|SubstitutionOverride</DummyDelegate.getValue: R|Stub (chain inference): TypeVariable(_V)|>|(this@R|/A|, ::R|/A.explicit|)
}
}
@@ -19,7 +19,7 @@ FILE: nullableTypeDelegate.kt
public final var other: R|MyClassSome?|by this@R|/MyClassSome|.R|/directed|<R|MyClassSome|, R|MyClassSome|>(<getClass>(Q|MyClassSome|).R|kotlin/jvm/java|<R|MyClassSome|>)
public get(): R|MyClassSome?| {
^ this@R|/MyClassSome|.D|/MyClassSome.other|.R|SubstitutionOverride</Delegate.getValue: R|Stub (builder inference): TypeVariable(_Target)?|>|(this@R|/MyClassSome|, ::R|/MyClassSome.other|)
^ this@R|/MyClassSome|.D|/MyClassSome.other|.R|SubstitutionOverride</Delegate.getValue: R|Stub (chain inference): TypeVariable(_Target)?|>|(this@R|/MyClassSome|, ::R|/MyClassSome.other|)
}
public set(<set-?>: R|MyClassSome?|): R|kotlin/Unit| {
this@R|/MyClassSome|.D|/MyClassSome.other|.R|SubstitutionOverride</Delegate.setValue: R|kotlin/Unit|>|(this@R|/MyClassSome|, ::R|/MyClassSome.other|, R|<local>/other|)
@@ -26,7 +26,7 @@ FILE: propertyWithFunctionalType.kt
}
)
public get(): R|(B) -> B| {
^ this@R|/A|.D|/A.conventerWithExpectedType|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|Stub (builder inference): TypeVariable(_T)|>|(this@R|/A|, ::R|/A.conventerWithExpectedType|)
^ this@R|/A|.D|/A.conventerWithExpectedType|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|Stub (chain inference): TypeVariable(_T)|>|(this@R|/A|, ::R|/A.conventerWithExpectedType|)
}
public set(<set-?>: R|(B) -> B|): R|kotlin/Unit| {
this@R|/A|.D|/A.conventerWithExpectedType|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/A|, ::R|/A.conventerWithExpectedType|, R|<local>/conventerWithExpectedType|)
@@ -30,14 +30,14 @@ FILE: hideBySeverity.kt
super<R|BaseState|>()
}
public final val hideBySeverityDerived: R|kotlin/collections/MutableSet<kotlin/Int>|by this@R|/Some|.R|/BaseState.propertyDerived|<R|kotlin/collections/MutableSet<kotlin/Int>|>(R|kotlin/collections/mutableSetOf|<R|kotlin/Int|>()).R|SubstitutionOverride</StoredPropertyDerived.provideDelegate: R|StoredPropertyBase<Stub (builder inference): TypeVariable(_PROPERTY_TYPE)>|>|(this@R|/Some|, ::R|/Some.hideBySeverityDerived|)
public final val hideBySeverityDerived: R|kotlin/collections/MutableSet<kotlin/Int>|by this@R|/Some|.R|/BaseState.propertyDerived|<R|kotlin/collections/MutableSet<kotlin/Int>|>(R|kotlin/collections/mutableSetOf|<R|kotlin/Int|>()).R|SubstitutionOverride</StoredPropertyDerived.provideDelegate: R|StoredPropertyBase<Stub (chain inference): TypeVariable(_PROPERTY_TYPE)>|>|(this@R|/Some|, ::R|/Some.hideBySeverityDerived|)
public get(): R|kotlin/collections/MutableSet<kotlin/Int>| {
^ this@R|/Some|.D|/Some.hideBySeverityDerived|.R|SubstitutionOverride</StoredPropertyBase.getValue: R|Stub (builder inference): TypeVariable(_PROPERTY_TYPE)|>|(this@R|/Some|, ::R|/Some.hideBySeverityDerived|)
^ this@R|/Some|.D|/Some.hideBySeverityDerived|.R|SubstitutionOverride</StoredPropertyBase.getValue: R|Stub (chain inference): TypeVariable(_PROPERTY_TYPE)|>|(this@R|/Some|, ::R|/Some.hideBySeverityDerived|)
}
public final val hideBySeverityBase: R|kotlin/collections/MutableSet<kotlin/Int>|by this@R|/Some|.R|/BaseState.propertyBase|<R|kotlin/collections/MutableSet<kotlin/Int>|>(R|kotlin/collections/mutableSetOf|<R|kotlin/Int|>())
public get(): R|kotlin/collections/MutableSet<kotlin/Int>| {
^ this@R|/Some|.D|/Some.hideBySeverityBase|.R|SubstitutionOverride</StoredPropertyBase.getValue: R|Stub (builder inference): TypeVariable(_PROPERTY_TYPE)|>|(this@R|/Some|, ::R|/Some.hideBySeverityBase|)
^ this@R|/Some|.D|/Some.hideBySeverityBase|.R|SubstitutionOverride</StoredPropertyBase.getValue: R|Stub (chain inference): TypeVariable(_PROPERTY_TYPE)|>|(this@R|/Some|, ::R|/Some.hideBySeverityBase|)
}
}
@@ -357,7 +357,7 @@ sealed class ConeStubType(val constructor: ConeStubTypeConstructor, override val
}
}
open class ConeStubTypeForBuilderInference(constructor: ConeStubTypeConstructor, nullability: ConeNullability) :
open class ConeStubTypeForChainInference(constructor: ConeStubTypeConstructor, nullability: ConeNullability) :
ConeStubType(constructor, nullability) {
constructor(variable: ConeTypeVariable, nullability: ConeNullability) : this(
ConeStubTypeConstructor(
@@ -367,8 +367,8 @@ open class ConeStubTypeForBuilderInference(constructor: ConeStubTypeConstructor,
)
}
class ConeStubTypeForFixation(constructor: ConeStubTypeConstructor, nullability: ConeNullability) :
ConeStubTypeForBuilderInference(constructor, nullability)
class ConeStubTypeForSyntheticFixation(constructor: ConeStubTypeConstructor, nullability: ConeNullability) :
ConeStubTypeForChainInference(constructor, nullability)
class ConeStubTypeForTypeVariableInSubtyping(constructor: ConeStubTypeConstructor, nullability: ConeNullability) :
ConeStubType(constructor, nullability) {
@@ -46,7 +46,8 @@ fun ConeKotlinType.render(): String {
postfix = ")"
)
}
is ConeStubTypeForBuilderInference -> "${renderAttributes()}Stub (builder inference): ${constructor.variable}"
is ConeStubTypeForChainInference -> "${renderAttributes()}Stub (chain inference): ${constructor.variable}"
is ConeStubTypeForSyntheticFixation -> "${renderAttributes()}Stub (fixation): ${constructor.variable}"
is ConeStubType -> "${renderAttributes()}Stub (subtyping): ${constructor.variable}"
is ConeIntegerLiteralType -> "${renderAttributes()}ILT: $value"
} + nullabilitySuffix
@@ -264,7 +264,7 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
override fun createStubTypeForBuilderInference(typeVariable: TypeVariableMarker): StubTypeMarker {
require(typeVariable is ConeTypeVariable) { "$typeVariable should subtype of ${ConeTypeVariable::class.qualifiedName}" }
return ConeStubTypeForBuilderInference(typeVariable, ConeNullability.create(typeVariable.defaultType().isMarkedNullable()))
return ConeStubTypeForChainInference(typeVariable, ConeNullability.create(typeVariable.defaultType().isMarkedNullable()))
}
override fun createStubTypeForTypeVariablesInSubtyping(typeVariable: TypeVariableMarker): StubTypeMarker {
@@ -429,7 +429,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
}
override fun SimpleTypeMarker.isStubTypeForBuilderInference(): Boolean {
return this is ConeStubTypeForBuilderInference
return this is ConeStubTypeForChainInference
}
override fun TypeConstructorMarker.unwrapStubTypeVariableConstructor(): TypeConstructorMarker {
@@ -165,7 +165,7 @@ fun <T : ConeKotlinType> T.withNullability(
ConeNullability.UNKNOWN -> this // TODO: is that correct?
ConeNullability.NOT_NULL -> this
}
is ConeStubTypeForBuilderInference -> ConeStubTypeForBuilderInference(constructor, nullability)
is ConeStubTypeForChainInference -> ConeStubTypeForChainInference(constructor, nullability)
is ConeStubTypeForTypeVariableInSubtyping -> ConeStubTypeForTypeVariableInSubtyping(constructor, nullability)
is ConeDefinitelyNotNullType -> when (nullability) {
ConeNullability.NOT_NULL -> this
@@ -76,7 +76,7 @@ class FirBuilderInferenceSession(
private fun ConeKotlinType.containsStubType(): Boolean {
return this.contains {
it is ConeStubTypeForBuilderInference
it is ConeStubTypeForChainInference
}
}
@@ -35,7 +35,7 @@ class FirDelegatedPropertyInferenceSession(
private fun ConeKotlinType.containsStubType(): Boolean {
return this.contains {
it is ConeStubTypeForBuilderInference
it is ConeStubTypeForChainInference
}
}
@@ -155,7 +155,7 @@ class FirDelegatedPropertyInferenceSession(
typeVariable as ConeTypeVariable
completionContext.fixVariable(
typeVariable,
ConeStubTypeForFixation(
ConeStubTypeForSyntheticFixation(
ConeStubTypeConstructor(typeVariable, isTypeVariableInSubtyping = false, isForFixation = true),
ConeNullability.create(typeVariable.defaultType.isMarkedNullable)
),
@@ -248,7 +248,7 @@ class FirDelegatedPropertyInferenceSession(
}
stubTypesByTypeVariable.getOrPut(variable) {
ConeStubTypeForBuilderInference(
ConeStubTypeForChainInference(
syntheticVariable,
ConeNullability.create(syntheticVariable.defaultType.isMarkedNullable)
).also {