From 9606a5a44154f1565b736cf80e36adde231f5b19 Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Fri, 16 Feb 2024 13:43:08 +0100 Subject: [PATCH] [Tests] Add test for vararg callable reference adaption with typealias #KT-65817 Fixed --- .../genericCallWithReferenceAgainstVararg.fir.kt | 11 +++++++++++ .../genericCallWithReferenceAgainstVararg.kt | 11 +++++++++++ .../genericCallWithReferenceAgainstVararg.txt | 3 +++ 3 files changed, 25 insertions(+) diff --git a/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.fir.kt b/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.fir.kt index 456c8a638e7..bf86134f5d6 100644 --- a/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.fir.kt @@ -1,6 +1,10 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER fun foo(vararg ints: Int) {} + +typealias MyInt = Int +fun fooAlias(vararg ints: MyInt) {} + fun test(i: IntArray) { myLet(i, ::foo) myLet(::foo) @@ -8,6 +12,13 @@ fun test(i: IntArray) { myLet(::foo) myLetExplicit1(::foo) myLetExplicit2(::foo) + + myLet(i, ::fooAlias) + myLet(::fooAlias) + myLet(::fooAlias) + myLet(::fooAlias) + myLetExplicit1(::fooAlias) + myLetExplicit2(::fooAlias) } fun myLet(t: T, block: (T) -> Unit) {} diff --git a/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.kt b/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.kt index f8232894e56..5d386dd0cbb 100644 --- a/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.kt +++ b/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.kt @@ -1,6 +1,10 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER fun foo(vararg ints: Int) {} + +typealias MyInt = Int +fun fooAlias(vararg ints: MyInt) {} + fun test(i: IntArray) { myLet(i, ::foo) myLet(::foo) @@ -8,6 +12,13 @@ fun test(i: IntArray) { myLet(::foo) myLetExplicit1(::foo) myLetExplicit2(::foo) + + myLet(i, ::fooAlias) + myLet(::fooAlias) + myLet(::fooAlias) + myLet(::fooAlias) + myLetExplicit1(::fooAlias) + myLetExplicit2(::fooAlias) } fun myLet(t: T, block: (T) -> Unit) {} diff --git a/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.txt b/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.txt index 7eb594a979a..c272feef73f 100644 --- a/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.txt +++ b/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.txt @@ -1,8 +1,11 @@ package public fun foo(/*0*/ vararg ints: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit +public fun fooAlias(/*0*/ vararg ints: MyInt /* = kotlin.Int */ /*kotlin.IntArray*/): kotlin.Unit public fun myLet(/*0*/ block: (T) -> kotlin.Unit): kotlin.Unit public fun myLet(/*0*/ t: T, /*1*/ block: (T) -> kotlin.Unit): kotlin.Unit public fun myLetExplicit1(/*0*/ block: (kotlin.Int) -> kotlin.Unit): kotlin.Unit public fun myLetExplicit2(/*0*/ block: (kotlin.IntArray) -> kotlin.Unit): kotlin.Unit public fun test(/*0*/ i: kotlin.IntArray): kotlin.Unit +public typealias MyInt = kotlin.Int +