Files
kotlin-fork/idea/testData/refactoring/extractFunction/controlFlow/outputValues/genericPair.kt.after
T
Dmitriy Novozhilov b66bbdf7a6 [IDE-NI-MIGRATE] [BAD] Migrate testdata of Extraction tests
Bad tests:
- IntroduceTypeParameter.testDuplicates
- IntroduceTypeParameter.testNullableType
- IntroduceTypeParameter.testUserType
- IntroduceTypeParameter.testFunctionType
- IntroduceTypeParameter.testInClass
- ExtractFunction.TypeParameters.testNoVarianceInFun
- ExtractFunction.Parameters.CandidateTypes.testNonNullableTypes
- ExtractFunction.Parameters.CandidateTypes.testMultipleTypes
- ExtractFunction.ControlFlow.OutputValues.testGenericPair
- IntroduceVariable.ExplicateTypeArguments.testDeeperNestedCall
2019-05-06 11:36:28 +03:00

29 lines
678 B
Plaintext
Vendored

// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
// WITH_RUNTIME
// PARAM_TYPES: A?, kotlin.Any?
// PARAM_TYPES: B, A
// PARAM_TYPES: kotlin.Int
// PARAM_DESCRIPTOR: var a: A? defined in foo
// PARAM_DESCRIPTOR: value-parameter b: B defined in foo
// PARAM_DESCRIPTOR: var c: kotlin.Int defined in foo
// SIBLING:
fun <A: Any, B: A> foo(b: B): Int {
var a: A? = null
var c: Int = 1
val pair = pair(a, b, c)
a = pair.first
c = pair.second
return a.hashCode() ?: 0 + c
}
private fun <A : Any, B : A> pair(a: A?, b: B, c: Int): Pair<A?, Int> {
var a1 = a
var c1 = c
a1 = b
c1 += 2
println(a1)
println(c1)
return Pair(a1, c1)
}