diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt index 4f58f8a7d30..7d55604850d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt @@ -112,7 +112,10 @@ class CandidateResolver( private fun CallCandidateResolutionContext<*>.processTypeArguments() = check { val jetTypeArguments = call.getTypeArguments() - if (!jetTypeArguments.isEmpty()) { + if (candidateCall.knownTypeParametersSubstitutor != null) { + candidateCall.setResultingSubstitutor(candidateCall.knownTypeParametersSubstitutor!!) + } + else if (!jetTypeArguments.isEmpty()) { // Explicit type arguments passed val typeArguments = ArrayList() @@ -140,9 +143,6 @@ class CandidateResolver( candidateCall.setResultingSubstitutor(substitutor) } - else if (candidateCall.getKnownTypeParametersSubstitutor() != null) { - candidateCall.setResultingSubstitutor(candidateCall.getKnownTypeParametersSubstitutor()!!) - } } private fun CallCandidateResolutionContext.mapArguments() diff --git a/compiler/testData/diagnostics/tests/Bounds.kt b/compiler/testData/diagnostics/tests/Bounds.kt index f3a6e80bdb8..2efca46f280 100644 --- a/compiler/testData/diagnostics/tests/Bounds.kt +++ b/compiler/testData/diagnostics/tests/Bounds.kt @@ -20,7 +20,7 @@ package boundsWithSubstitutors class Pair - abstract class CInt>, X : (B<Char>) -> PairAny>, B>>() : B<Any>() { // 2 errors + abstract class CInt>, X : (B<Char>) -> PairAny>, B>>() : B<Any>() { // 2 errors val a = B<Char>() // error abstract val x : (B<Char>) -> B<Any> diff --git a/compiler/testData/diagnostics/tests/generics/RecursiveUpperBoundCheck.kt b/compiler/testData/diagnostics/tests/generics/RecursiveUpperBoundCheck.kt index 33a4ca82b6f..33add95e801 100644 --- a/compiler/testData/diagnostics/tests/generics/RecursiveUpperBoundCheck.kt +++ b/compiler/testData/diagnostics/tests/generics/RecursiveUpperBoundCheck.kt @@ -1,3 +1,3 @@ open class C> class TestOK : C() -class TestFail : C<C<TestFail>>() +class TestFail : C<C<TestFail>>() diff --git a/compiler/testData/diagnostics/tests/regressions/kt7585/base.kt b/compiler/testData/diagnostics/tests/regressions/kt7585/base.kt index 29437c00907..ac1a659a8cc 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt7585/base.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt7585/base.kt @@ -7,7 +7,7 @@ abstract class Wrapper(protected val t: T) class MyWrapper(a: A): Wrapper(a) // This wrapper is not legal -class TheirWrapper(e: E): Wrapper<E>(e) +class TheirWrapper(e: E): Wrapper<E>(e) data class Pair(val a: T, val b: T) diff --git a/compiler/testData/diagnostics/tests/regressions/kt7585/java.kt b/compiler/testData/diagnostics/tests/regressions/kt7585/java.kt index e81d97b1f80..8aae56822bb 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt7585/java.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt7585/java.kt @@ -17,7 +17,7 @@ class E class MyWrapper(a: A): Wrapper(a) // This wrapper is not legal -class TheirWrapper(e: E): Wrapper<E>(e) +class TheirWrapper(e: E): Wrapper<E>(e) data class Pair(val a: T, val b: T)