KT-7433 Type inference pushes Unit inside generic function with lower bound constraint
#KT-7433 Fixed #KT-7351 Fixed
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
package kt7351
|
||||
|
||||
trait Node
|
||||
|
||||
trait Source<T> {
|
||||
fun f() : T
|
||||
}
|
||||
fun <T, S : Source<T>> S.woo() : T = this.f()
|
||||
|
||||
fun Node.append(block : Source<Int>.() -> Unit) {
|
||||
}
|
||||
|
||||
fun crashMe(node : Node) {
|
||||
node.append {
|
||||
woo()
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package
|
||||
|
||||
package kt7351 {
|
||||
internal fun crashMe(/*0*/ node: kt7351.Node): kotlin.Unit
|
||||
internal fun kt7351.Node.append(/*0*/ block: kt7351.Source<kotlin.Int>.() -> kotlin.Unit): kotlin.Unit
|
||||
internal fun </*0*/ T, /*1*/ S : kt7351.Source<T>> S.woo(): T
|
||||
|
||||
internal trait Node {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal trait Source</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal abstract fun f(): T
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
public inline fun <S, T: S> Iterable<T>.reduce1(operation: (S, T) -> S): S = throw Exception()
|
||||
|
||||
fun test(ints: List<Int>) {
|
||||
val f: () -> Unit = {
|
||||
ints.reduce1 { a, b -> a + b }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
internal fun test(/*0*/ ints: kotlin.List<kotlin.Int>): kotlin.Unit
|
||||
kotlin.inline() public fun </*0*/ S, /*1*/ T : S> kotlin.Iterable<T>.reduce1(/*0*/ operation: (S, T) -> S): S
|
||||
Reference in New Issue
Block a user