FIR: preliminary refactoring of delegate resolve
This commit is contained in:
committed by
teamcity
parent
a19495cb26
commit
4d9e919f7e
Vendored
+4
-2
@@ -190,9 +190,9 @@ digraph delegateWithAnonymousObject_kt {
|
||||
71 [label="Enter property" style="filled" fillcolor=red];
|
||||
72 [label="Postponed enter to lambda"];
|
||||
73 [label="Postponed exit from lambda"];
|
||||
74 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
|
||||
74 [label="Function call: R?C|/delegate|(...)"];
|
||||
75 [label="Access variable this@R|/IssuesListUserProfile|"];
|
||||
76 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...).<Unresolved name: provideDelegate>#(...)"];
|
||||
76 [label="Function call: R?C|/delegate|(...).R?C|special/error|(...)"];
|
||||
77 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_19 {
|
||||
color=blue
|
||||
@@ -216,6 +216,8 @@ digraph delegateWithAnonymousObject_kt {
|
||||
79 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
|
||||
80 [label="Exit property" style="filled" fillcolor=red];
|
||||
}
|
||||
70 -> {71};
|
||||
71 -> {72} [color=red];
|
||||
71 -> {72};
|
||||
72 -> {73};
|
||||
72 -> {} [style=dashed];
|
||||
|
||||
+2
-2
@@ -30,9 +30,9 @@ FILE: hideBySeverity.kt
|
||||
super<R|BaseState|>()
|
||||
}
|
||||
|
||||
public final val hideBySeverityDerived: R|kotlin/collections/MutableSet<kotlin/Int>|by this@R|/Some|.<CS errors: /BaseState.propertyDerived>#<R|ERROR CLASS: Cannot infer argument for type parameter PROPERTY_TYPE|>(R|kotlin/collections/mutableSetOf|<R|ERROR CLASS: Cannot infer argument for type parameter T|>()).R|SubstitutionOverride</StoredPropertyDerived.provideDelegate: R|StoredPropertyBase<ERROR CLASS: Cannot infer argument for type parameter 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<kotlin/collections/MutableSet<kotlin/Int>>|>|(this@R|/Some|, ::R|/Some.hideBySeverityDerived|)
|
||||
public get(): R|kotlin/collections/MutableSet<kotlin/Int>| {
|
||||
^ this@R|/Some|.D|/Some.hideBySeverityDerived|.R|SubstitutionOverride</StoredPropertyBase.getValue: <ERROR TYPE REF: Cannot infer argument for type parameter PROPERTY_TYPE>>|(this@R|/Some|, ::R|/Some.hideBySeverityDerived|)
|
||||
^ this@R|/Some|.D|/Some.hideBySeverityDerived|.R|SubstitutionOverride</StoredPropertyBase.getValue: R|kotlin/collections/MutableSet<kotlin/Int>|>|(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|>())
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ abstract class BaseState {
|
||||
}
|
||||
|
||||
abstract class Some : BaseState() {
|
||||
val hideBySeverityDerived: MutableSet<Int> by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>propertyDerived<!>(mutableSetOf())
|
||||
val hideBySeverityDerived: MutableSet<Int> by propertyDerived(mutableSetOf())
|
||||
|
||||
val hideBySeverityBase: MutableSet<Int> by propertyBase(mutableSetOf())
|
||||
}
|
||||
|
||||
+9
@@ -231,6 +231,15 @@ private fun mapInapplicableCandidateError(
|
||||
rootCause.isCastToNotNull
|
||||
)
|
||||
is DslScopeViolation -> FirErrors.DSL_SCOPE_VIOLATION.createOn(source, rootCause.calleeSymbol)
|
||||
is InferenceError -> {
|
||||
rootCause.constraintError.toDiagnostic(
|
||||
source,
|
||||
qualifiedAccessSource,
|
||||
session.typeContext,
|
||||
mutableSetOf(),
|
||||
diagnostic.candidate
|
||||
)
|
||||
}
|
||||
else -> genericDiagnostic
|
||||
}
|
||||
}.distinct()
|
||||
|
||||
+7
-1
@@ -27,7 +27,7 @@ abstract class AbstractManyCandidatesInferenceSession(
|
||||
get() = partiallyResolvedCalls.lastOrNull()
|
||||
?.second
|
||||
?.system
|
||||
?.currentStorage()
|
||||
?.asReadOnlyStorage()
|
||||
?: ConstraintStorage.Empty
|
||||
|
||||
override fun <T> addCompletedCall(call: T, candidate: Candidate) where T : FirResolvable, T : FirStatement {
|
||||
@@ -48,4 +48,10 @@ abstract class AbstractManyCandidatesInferenceSession(
|
||||
|
||||
protected val FirResolvable.candidate: Candidate
|
||||
get() = candidate()!!
|
||||
|
||||
override fun clear() {
|
||||
errorCalls.clear()
|
||||
partiallyResolvedCalls.clear()
|
||||
completedCalls.clear()
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -421,6 +421,7 @@ class ConstraintSystemCompleter(private val components: BodyResolveComponents) {
|
||||
fun FirStatement.processAllContainingCallCandidates(processBlocks: Boolean, processor: (Candidate) -> Unit) {
|
||||
when (this) {
|
||||
is FirFunctionCall -> {
|
||||
explicitReceiver?.processAllContainingCallCandidates(processBlocks, processor)
|
||||
processCandidateIfApplicable(processor, processBlocks)
|
||||
this.arguments.forEach { it.processAllContainingCallCandidates(processBlocks, processor) }
|
||||
}
|
||||
@@ -446,10 +447,12 @@ fun FirStatement.processAllContainingCallCandidates(processBlocks: Boolean, proc
|
||||
}
|
||||
|
||||
is FirQualifiedAccessExpression -> {
|
||||
explicitReceiver?.processAllContainingCallCandidates(processBlocks, processor)
|
||||
processCandidateIfApplicable(processor, processBlocks)
|
||||
}
|
||||
|
||||
is FirVariableAssignment -> {
|
||||
explicitReceiver?.processAllContainingCallCandidates(processBlocks, processor)
|
||||
processCandidateIfApplicable(processor, processBlocks)
|
||||
rValue.processAllContainingCallCandidates(processBlocks, processor)
|
||||
}
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.fir.expressions.FirStatement
|
||||
import org.jetbrains.kotlin.fir.references.FirNamedReference
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.Candidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.InferenceError
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.ResolutionContext
|
||||
import org.jetbrains.kotlin.fir.resolve.defaultType
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
@@ -82,7 +83,7 @@ class FirDelegatedPropertyInferenceSession(
|
||||
|
||||
for ((_, candidate) in partiallyResolvedCalls) {
|
||||
for (error in commonSystem.errors) {
|
||||
candidate.system.addError(error)
|
||||
candidate.addDiagnostic(InferenceError(error))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -35,6 +35,8 @@ abstract class FirInferenceSession {
|
||||
abstract fun <T> writeOnlyStubs(call: T): Boolean where T : FirResolvable, T : FirStatement
|
||||
abstract fun <T> callCompleted(call: T): Boolean where T : FirResolvable, T : FirStatement
|
||||
abstract fun <T> shouldCompleteResolvedSubAtomsOf(call: T): Boolean where T : FirResolvable, T : FirStatement
|
||||
|
||||
abstract fun clear()
|
||||
}
|
||||
|
||||
abstract class FirStubInferenceSession : FirInferenceSession() {
|
||||
@@ -56,4 +58,7 @@ abstract class FirStubInferenceSession : FirInferenceSession() {
|
||||
override fun <T> writeOnlyStubs(call: T): Boolean where T : FirResolvable, T : FirStatement = false
|
||||
override fun <T> callCompleted(call: T): Boolean where T : FirResolvable, T : FirStatement = false
|
||||
override fun <T> shouldCompleteResolvedSubAtomsOf(call: T): Boolean where T : FirResolvable, T : FirStatement = true
|
||||
|
||||
override fun clear() {
|
||||
}
|
||||
}
|
||||
|
||||
+12
-3
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.fir.expressions.builder.buildUnitExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirLazyBlock
|
||||
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.resolve.ResolutionMode
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.FirErrorReferenceWithCandidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate
|
||||
import org.jetbrains.kotlin.fir.resolve.constructFunctionalTypeRef
|
||||
import org.jetbrains.kotlin.fir.resolve.dfa.FirControlFlowGraphReferenceImpl
|
||||
@@ -140,7 +141,6 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
var backingFieldIsAlreadyResolved = false
|
||||
context.withProperty(property) {
|
||||
context.forPropertyInitializer {
|
||||
property.transformDelegate(transformer, ResolutionMode.ContextDependentDelegate)
|
||||
if (!initializerIsAlreadyResolved) {
|
||||
property.transformChildrenWithoutComponents(returnTypeRef)
|
||||
property.replaceBodyResolveState(FirPropertyBodyResolveState.INITIALIZER_RESOLVED)
|
||||
@@ -265,6 +265,13 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
|
||||
private fun transformPropertyAccessorsWithDelegate(property: FirProperty, delegateExpression: FirExpression) {
|
||||
context.forPropertyDelegateAccessors(property, delegateExpression, resolutionContext, callCompleter) {
|
||||
if (property.isLocal) {
|
||||
property.transformDelegate(transformer, ResolutionMode.ContextDependentDelegate)
|
||||
} else {
|
||||
context.forPropertyInitializer {
|
||||
property.transformDelegate(transformer, ResolutionMode.ContextDependentDelegate)
|
||||
}
|
||||
}
|
||||
property.transformAccessors()
|
||||
val completedCalls = completeCandidates()
|
||||
val finalSubstitutor = createFinalSubstitutor()
|
||||
@@ -290,6 +297,8 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
val delegateProvider = wrappedDelegateExpression.delegateProvider.transformSingle(transformer, data)
|
||||
when (val calleeReference = (delegateProvider as FirResolvable).calleeReference) {
|
||||
is FirResolvedNamedReference -> return delegateProvider
|
||||
is FirErrorReferenceWithCandidate -> {
|
||||
}
|
||||
is FirNamedReferenceWithCandidate -> {
|
||||
val candidate = calleeReference.candidate
|
||||
if (!candidate.system.hasContradiction) {
|
||||
@@ -298,7 +307,9 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
}
|
||||
}
|
||||
|
||||
context.inferenceSession.clear()
|
||||
(delegateProvider as? FirFunctionCall)?.let { dataFlowAnalyzer.dropSubgraphFromCall(it) }
|
||||
|
||||
return wrappedDelegateExpression.expression
|
||||
.transformSingle(transformer, data)
|
||||
.approximateIfIsIntegerConst()
|
||||
@@ -309,7 +320,6 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
|
||||
private fun transformLocalVariable(variable: FirProperty): FirProperty {
|
||||
assert(variable.isLocal)
|
||||
variable.transformDelegate(transformer, ResolutionMode.ContextDependentDelegate)
|
||||
val delegate = variable.delegate
|
||||
|
||||
val hadExplicitType = variable.returnTypeRef !is FirImplicitTypeRef
|
||||
@@ -341,7 +351,6 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
val data = withExpectedType(returnTypeRef)
|
||||
return transformReturnTypeRef(transformer, data)
|
||||
.transformInitializer(transformer, data)
|
||||
.transformDelegate(transformer, data)
|
||||
.transformTypeParameters(transformer, data)
|
||||
.transformOtherChildren(transformer, data)
|
||||
}
|
||||
|
||||
+2
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintSystemError
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability.*
|
||||
|
||||
@@ -101,6 +102,7 @@ class ManyLambdaExpressionArguments(
|
||||
class InfixCallOfNonInfixFunction(val function: FirNamedFunctionSymbol) : ResolutionDiagnostic(INAPPLICABLE_MODIFIER)
|
||||
class OperatorCallOfNonOperatorFunction(val function: FirNamedFunctionSymbol) : ResolutionDiagnostic(INAPPLICABLE_MODIFIER)
|
||||
|
||||
class InferenceError(val constraintError: ConstraintSystemError) : ResolutionDiagnostic(constraintError.applicability)
|
||||
class Unsupported(val message: String, val source: KtSourceElement? = null) : ResolutionDiagnostic(UNSUPPORTED)
|
||||
|
||||
object PropertyAsOperator : ResolutionDiagnostic(PROPERTY_AS_OPERATOR)
|
||||
|
||||
+2
-2
@@ -33,8 +33,8 @@ operator fun CustomDelegate3.setValue(thisRef: Any?, prop: KProperty<*>, value:
|
||||
|
||||
class Example {
|
||||
|
||||
var a by <!DELEGATE_SPECIAL_FUNCTION_MISSING, DELEGATE_SPECIAL_FUNCTION_MISSING!>CustomDelegate()<!>
|
||||
val aval by <!DELEGATE_SPECIAL_FUNCTION_MISSING!>CustomDelegate()<!>
|
||||
var a by <!DELEGATE_SPECIAL_FUNCTION_MISSING, DELEGATE_SPECIAL_FUNCTION_MISSING, NEW_INFERENCE_ERROR!>CustomDelegate()<!>
|
||||
val aval by <!DELEGATE_SPECIAL_FUNCTION_MISSING, NEW_INFERENCE_ERROR!>CustomDelegate()<!>
|
||||
var b by OkDelegate()
|
||||
var c by CustomDelegate2()
|
||||
var d by CustomDelegate3()
|
||||
|
||||
compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.fir.kt
Vendored
+4
-4
@@ -9,10 +9,10 @@ class A(outer: Outer) {
|
||||
var g: String by outer.getContainer().getMyProperty()
|
||||
|
||||
|
||||
var b: String by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(getMyProperty())<!>
|
||||
var r: String by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(outer.getContainer().getMyProperty())<!>
|
||||
var e: String by + <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(getMyProperty())
|
||||
var f: String by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(getMyProperty()) - 1
|
||||
var b: String by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getMyProperty<!>())<!>
|
||||
var r: String by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(outer.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getContainer<!>().<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getMyProperty<!>())<!>
|
||||
var e: String by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>+<!> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getMyProperty<!>())<!>
|
||||
var f: String by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getMyProperty<!>()) <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>-<!> 1<!>
|
||||
}
|
||||
|
||||
fun <A, B> foo(a: Any?) = MyProperty<A, B>()
|
||||
|
||||
Vendored
+1
-1
@@ -24,4 +24,4 @@ class C<R>() {
|
||||
}
|
||||
|
||||
var c1: Int by C()
|
||||
var c2: Int by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, DELEGATE_SPECIAL_FUNCTION_RETURN_TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>C<Number>()<!>
|
||||
var c2: Int by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, DELEGATE_SPECIAL_FUNCTION_RETURN_TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>C<Number>()<!>
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
var a: Int by A()
|
||||
var a1 by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>A()<!>
|
||||
var a1 by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>A<!>()<!>
|
||||
|
||||
var b: Int by B()
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -8,6 +8,6 @@ object CommonCase {
|
||||
operator fun <D, E, R> Fas<D, E, R>.provideDelegate(host: D, p: Any?): Fas<D, E, R> = TODO()
|
||||
operator fun <D, E, R> Fas<D, E, R>.getValue(receiver: E, p: Any?): R = TODO()
|
||||
|
||||
val Long.test1: String by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>delegate<!>() // common test, not working because of Inference1
|
||||
val Long.test1: String by delegate() // common test, not working because of Inference1
|
||||
val Long.test2: String by delegate<CommonCase, Long, String>() // should work
|
||||
}
|
||||
|
||||
Vendored
-13
@@ -1,13 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
object T2 {
|
||||
interface Foo<T>
|
||||
|
||||
fun <T> delegate(): Foo<T> = TODO()
|
||||
|
||||
operator fun <T> Foo<T>.provideDelegate(host: T2, p: Any?): Foo<T> = TODO()
|
||||
operator fun <T> Foo<T>.getValue(receiver: String, p: Any?): T = TODO()
|
||||
|
||||
val String.test1: String by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>delegate<!>()
|
||||
val test2: String by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>delegate<!>()<!>
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
object T2 {
|
||||
|
||||
Vendored
-12
@@ -1,12 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
object T3 {
|
||||
interface Foo<T>
|
||||
|
||||
fun <T> delegate(): Foo<T> = TODO()
|
||||
|
||||
operator fun <T> Foo<T>.provideDelegate(host: T3, p: Any?): Foo<T> = TODO()
|
||||
operator fun <T> Foo<T>.getValue(receiver: T3, p: Any?): T = TODO()
|
||||
|
||||
val test1: String by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>delegate<!>()
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
object T3 {
|
||||
|
||||
Vendored
+1
-1
@@ -8,6 +8,6 @@ object Inference2 {
|
||||
operator fun <T> Foo<T>.provideDelegate(host: T, p: Any?): Foo<T> = TODO()
|
||||
operator fun <T> Foo<T>.getValue(receiver: Inference2, p: Any?): String = TODO()
|
||||
|
||||
val test1: String by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>delegate<!>() // same story like in Inference1
|
||||
val test1: String by delegate() // same story like in Inference1
|
||||
val test2: String by delegate<Inference2>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
abstract class MainActivity : DIAware1() {
|
||||
val bar: Bar by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>instance1<!>()
|
||||
val bar: Bar by instance1()
|
||||
}
|
||||
|
||||
class Bar
|
||||
|
||||
+1
-1
@@ -9,6 +9,6 @@ operator fun String.provideDelegate(thisRef: Any?, prop: Any) = WrongDelegate(th
|
||||
|
||||
operator fun String.getValue(thisRef: Any?, prop: Any) = this
|
||||
|
||||
val test1: String by <!TYPE_MISMATCH, TYPE_MISMATCH!>"OK"<!>
|
||||
val test1: String by <!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>"OK"<!>
|
||||
val test2: Int by "OK"
|
||||
val test3 by "OK"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
val c: Int by <!DELEGATE_SPECIAL_FUNCTION_RETURN_TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>Delegate()<!>
|
||||
val c: Int by <!DELEGATE_SPECIAL_FUNCTION_RETURN_TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>Delegate()<!>
|
||||
|
||||
class Delegate {
|
||||
operator fun getValue(t: Any?, p: KProperty<*>): String {
|
||||
|
||||
Reference in New Issue
Block a user