[FE] Implement temporary resolution algorithm
This commit is contained in:
committed by
TeamCityServer
parent
d923c95671
commit
c34fe8d547
@@ -1194,6 +1194,9 @@ public interface Errors {
|
||||
DiagnosticFactory1<KtElement, String> ERROR_IN_CONTRACT_DESCRIPTION = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<KtElement, String> CONTRACT_NOT_ALLOWED = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
// Context receivers
|
||||
DiagnosticFactory1<KtElement, String> NO_CONTEXT_RECEIVER = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
// Error sets
|
||||
ImmutableSet<? extends DiagnosticFactory<?>> UNRESOLVED_REFERENCE_DIAGNOSTICS = ImmutableSet.of(
|
||||
UNRESOLVED_REFERENCE, NAMED_PARAMETER_NOT_FOUND, UNRESOLVED_REFERENCE_WRONG_RECEIVER);
|
||||
|
||||
+2
@@ -1086,6 +1086,8 @@ public class DefaultErrorMessages {
|
||||
MAP.put(ERROR_IN_CONTRACT_DESCRIPTION, "Error in contract description: {0}", TO_STRING);
|
||||
MAP.put(CONTRACT_NOT_ALLOWED, "{0}", TO_STRING);
|
||||
|
||||
MAP.put(NO_CONTEXT_RECEIVER, "No required context receiver found: {0}", TO_STRING);
|
||||
|
||||
MAP.setImmutable();
|
||||
|
||||
for (Field field : Errors.class.getFields()) {
|
||||
|
||||
+9
@@ -93,6 +93,15 @@ class DiagnosticReporterByTrackingStrategy(
|
||||
)
|
||||
)
|
||||
}
|
||||
NoContextReceiver::class.java -> {
|
||||
val callElement = psiKotlinCall.psiCall.callElement
|
||||
trace.report(
|
||||
NO_CONTEXT_RECEIVER.on(
|
||||
callElement,
|
||||
(diagnostic as NoContextReceiver).receiverDescriptor.value.toString()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -74,6 +74,12 @@ public abstract class DelegatingResolvedCall<D extends CallableDescriptor> imple
|
||||
return resolvedCall.getDispatchReceiver();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<ReceiverValue> getContextReceivers() {
|
||||
return resolvedCall.getContextReceivers();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ExplicitReceiverKind getExplicitReceiverKind() {
|
||||
|
||||
@@ -69,6 +69,10 @@ public interface ResolvedCall<D extends CallableDescriptor> {
|
||||
@Nullable
|
||||
ReceiverValue getDispatchReceiver();
|
||||
|
||||
/** If the target was a function or property with context receivers, this is the value for its context receiver parameters */
|
||||
@NotNull
|
||||
List<ReceiverValue> getContextReceivers();
|
||||
|
||||
/** Determines whether receiver argument or this object is substituted for explicit receiver */
|
||||
@NotNull
|
||||
ExplicitReceiverKind getExplicitReceiverKind();
|
||||
|
||||
@@ -288,6 +288,12 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
||||
return dispatchReceiver;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<ReceiverValue> getContextReceivers() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ExplicitReceiverKind getExplicitReceiverKind() {
|
||||
|
||||
Reference in New Issue
Block a user