diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt index 491475f66c5..11ad03d61bc 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.resolve.calls.components @@ -228,12 +217,9 @@ private fun KotlinResolutionCandidate.resolveKotlinArgument( isReceiver: Boolean ) { val expectedType = candidateParameter?.let { - resolvedCall.substitutor.substituteKeepAnnotations( - argument.getExpectedType( - candidateParameter, - callComponents.languageVersionSettings - ) - ) + val argumentType = argument.getExpectedType(candidateParameter, callComponents.languageVersionSettings) + val resultType = knownTypeParametersResultingSubstitutor?.substitute(argumentType) ?: argumentType + resolvedCall.substitutor.substituteKeepAnnotations(resultType) } addResolvedKtPrimitive(resolveKtPrimitive(csBuilder, argument, expectedType, this, isReceiver)) } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/bareTypesComplex.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/bareTypesComplex.kt index 91b43ecc41b..748e1b72a9b 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/bareTypesComplex.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/bareTypesComplex.kt @@ -1,10 +1,9 @@ -// !WITH_NEW_INFERENCE open class SuperOuter { inner open class SuperInner } class DerivedOuter : SuperOuter() { - inner class DerivedInner : SuperOuter.SuperInner() + inner class DerivedInner : SuperOuter.SuperInner() } fun bare(x: SuperOuter<*>.SuperInner<*>, y: Any?) { diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/secondLevelDepth.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/secondLevelDepth.kt index 97a989504e3..0f232098c81 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/secondLevelDepth.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/secondLevelDepth.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !CHECK_TYPE open class Outer { inner open class Inner { @@ -9,7 +8,7 @@ open class Outer { } class DerivedOuter : Outer() { - inner class DerivedInner : Inner() { + inner class DerivedInner : Inner() { fun foo(): Inner2 = null!! } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/innerSuperCall.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/innerSuperCall.kt index 1b3c22785a8..64d4139d014 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/innerSuperCall.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/innerSuperCall.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE open class Super { inner open class Inner { } @@ -6,5 +5,5 @@ open class Super { class Sub : Super() { // TODO: it would be nice to have a possibility to omit explicit type argument in supertype - inner class SubInner : Super.Inner() {} + inner class SubInner : Super.Inner() {} } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/innerSuperCallSecondary.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/innerSuperCallSecondary.kt index 361bbd6838c..9d96d736e46 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/innerSuperCallSecondary.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/innerSuperCallSecondary.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_PARAMETER open class Super { inner open class Inner { @@ -7,7 +6,7 @@ open class Super { class Sub : Super() { inner class SubInner : Super.Inner { - constructor() - constructor(x: Int) : super() {} + constructor() + constructor(x: Int) : super() {} } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/kt3357.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/kt3357.kt index 0075e0814b9..795e8235a6c 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/kt3357.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/kt3357.kt @@ -1,4 +1,3 @@ -// !WITH_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_VARIABLE open class Super { @@ -8,7 +7,7 @@ open class Super { } class Sub(): Super() { - inner class SubInner : Super.Inner() { // 'Inner' is unresolved + inner class SubInner : Super.Inner() { // 'Inner' is unresolved // Also, T1 is not resolved to anything, and not marked as resolved init { val x: Super.Inner = this // T1 is not resolved to anything