Fix rewrite at slice exception for callable references inside flatMap
#KT-40254 Fixed
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
fun <T> List<Option<T>>.flatten(): List<T> = <!AMBIGUITY!>flatMap<!> { <!UNRESOLVED_REFERENCE!>it<!>.<!INAPPLICABLE_CANDIDATE!>fold<!>(::emptyList, <!UNRESOLVED_REFERENCE!>::listOf<!>) }
|
||||
|
||||
class Option<out T> {
|
||||
fun <R> fold(ifEmpty: () -> R, ifSome: (T) -> R): R = TODO()
|
||||
}
|
||||
compiler/testData/diagnostics/tests/callableReference/resolve/resolveTwoReferencesAgainstGenerics.kt
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
fun <T> List<Option<T>>.flatten(): List<T> = flatMap { it.fold(::emptyList, ::listOf) }
|
||||
|
||||
class Option<out T> {
|
||||
fun <R> fold(ifEmpty: () -> R, ifSome: (T) -> R): R = TODO()
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T> kotlin.collections.List<Option<T>>.flatten(): kotlin.collections.List<T>
|
||||
|
||||
public final class Option</*0*/ out T> {
|
||||
public constructor Option</*0*/ out T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun </*0*/ R> fold(/*0*/ ifEmpty: () -> R, /*1*/ ifSome: (T) -> R): R
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user