KT-7597 ErrorType leaked into backend
#KT-7597 Fixed
This commit is contained in:
@@ -27,10 +27,7 @@ import org.jetbrains.kotlin.resolve.BindingContext.CALL
|
||||
import org.jetbrains.kotlin.resolve.BindingContext.RESOLVED_CALL
|
||||
import org.jetbrains.kotlin.resolve.calls.ArgumentTypeResolver
|
||||
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ArgumentMatch
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ArgumentMatchStatus
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ArgumentUnmapped
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
|
||||
@@ -67,12 +64,15 @@ public fun <D : CallableDescriptor> ResolvedCall<D>.getParameterForArgument(valu
|
||||
|
||||
public fun <C: ResolutionContext<C>> Call.hasUnresolvedArguments(context: ResolutionContext<C>): Boolean {
|
||||
val arguments = getValueArguments().map { it.getArgumentExpression() }
|
||||
return arguments.any {
|
||||
argument ->
|
||||
val expressionType = argument?.let { context.trace.getBindingContext().getType(it) }
|
||||
argument != null && !ArgumentTypeResolver.isFunctionLiteralArgument(argument, context)
|
||||
&& (expressionType == null || expressionType.isError())
|
||||
}
|
||||
return arguments.any (fun (argument: JetExpression?): Boolean {
|
||||
if (argument == null || ArgumentTypeResolver.isFunctionLiteralArgument(argument, context)) return false
|
||||
|
||||
val resolvedCall = argument.getResolvedCall(context.trace.getBindingContext()) as MutableResolvedCall<*>?
|
||||
if (resolvedCall != null && !resolvedCall.hasInferredReturnType()) return false
|
||||
|
||||
val expressionType = context.trace.getBindingContext().getType(argument)
|
||||
return expressionType == null || expressionType.isError()
|
||||
})
|
||||
}
|
||||
|
||||
public fun Call.getValueArgumentsInParentheses(): List<ValueArgument> = getValueArguments().filterArgsInParentheses()
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
trait Inv<I>
|
||||
|
||||
fun <S, T: S> Inv<T>.reduce2(): S = null!!
|
||||
|
||||
fun test(a: Inv<Int>): Int {
|
||||
val b = 1 <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> a.reduce2()
|
||||
return <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>b<!>
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package
|
||||
|
||||
internal fun test(/*0*/ a: Inv<kotlin.Int>): kotlin.Int
|
||||
internal fun </*0*/ S, /*1*/ T : S> Inv<T>.reduce2(): S
|
||||
|
||||
internal trait Inv</*0*/ I> {
|
||||
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,12 @@
|
||||
class ResolutionCandidate<A>
|
||||
|
||||
class ResolutionTask<B, C : B>(val candidate: ResolutionCandidate<B>)
|
||||
|
||||
fun <D, E : D> List<ResolutionTask<D, E>>.bar(t: ResolutionTask<D, E>) = t
|
||||
|
||||
public class ResolutionTaskHolder<F, G : F> {
|
||||
fun test(candidate: ResolutionCandidate<F>, tasks: MutableList<ResolutionTask<F, G>>) {
|
||||
tasks.bar(ResolutionTask(candidate))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package
|
||||
|
||||
internal fun </*0*/ D, /*1*/ E : D> kotlin.List<ResolutionTask<D, E>>.bar(/*0*/ t: ResolutionTask<D, E>): ResolutionTask<D, E>
|
||||
|
||||
internal final class ResolutionCandidate</*0*/ A> {
|
||||
public constructor ResolutionCandidate</*0*/ A>()
|
||||
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
|
||||
}
|
||||
|
||||
internal final class ResolutionTask</*0*/ B, /*1*/ C : B> {
|
||||
public constructor ResolutionTask</*0*/ B, /*1*/ C : B>(/*0*/ candidate: ResolutionCandidate<B>)
|
||||
internal final val candidate: ResolutionCandidate<B>
|
||||
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 ResolutionTaskHolder</*0*/ F, /*1*/ G : F> {
|
||||
public constructor ResolutionTaskHolder</*0*/ F, /*1*/ G : F>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final fun test(/*0*/ candidate: ResolutionCandidate<F>, /*1*/ tasks: kotlin.MutableList<ResolutionTask<F, G>>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -6,7 +6,7 @@ fun main(args:Array<String>) {
|
||||
val startTimeNanos = System.nanoTime()
|
||||
|
||||
// the problem sits on the next line:
|
||||
val pi = 4.0.toDouble() * delta * (1..n).reduce(
|
||||
val pi = 4.0.toDouble() * delta <!OVERLOAD_RESOLUTION_AMBIGUITY!>*<!> (1..n).reduce(
|
||||
{t, i ->
|
||||
val x = (i - 0.5) * delta
|
||||
<!TYPE_MISMATCH!>t + 1.0 / (1.0 + x * x)<!>
|
||||
|
||||
@@ -10231,6 +10231,18 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/nestedCalls/kt5971NestedSafeCall.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt7597.kt")
|
||||
public void testKt7597() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/nestedCalls/kt7597.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoTypeParameters.kt")
|
||||
public void testTwoTypeParameters() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/nestedCalls/twoTypeParameters.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/resolve/specialConstructions")
|
||||
|
||||
Reference in New Issue
Block a user