Do not check type depth for constrains generated on subtyping
#KT-38143 fixed
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
// Generic interface, nothing interesting here
|
||||
interface UseCase<in I, out O> {
|
||||
fun execute(input: I): O
|
||||
}
|
||||
|
||||
// We don't want to call use cases without input with explicit Unit argument, so we create this handy extension
|
||||
fun <O> UseCase<Unit, O>.execute(): O = execute(Unit)
|
||||
|
||||
class Foo : UseCase<Unit, List<List<List<String>>>> {
|
||||
override fun execute(input: Unit) = listOf(listOf(listOf("foo")))
|
||||
}
|
||||
|
||||
class Bar : UseCase<Unit, List<List<String>>> {
|
||||
override fun execute(input: Unit) = listOf(listOf("bar"))
|
||||
}
|
||||
|
||||
class Baz : UseCase<Unit, List<List<List<List<List<List<String>>>>>>> {
|
||||
override fun execute(input: Unit) = listOf(listOf(listOf(listOf(listOf(listOf("foo"))))))
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val foo = Foo()
|
||||
foo.execute(Unit) // Member: OK both versions
|
||||
foo.execute() // Extension: OI - OK, NI - was error: "Not enough information to infer type variable O"
|
||||
|
||||
val bar = Bar()
|
||||
bar.execute(Unit) // Member: OK both versions
|
||||
bar.execute() // Extension: OK both versions
|
||||
|
||||
val baz = Baz()
|
||||
baz.execute(Unit)
|
||||
baz.execute()
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
public fun </*0*/ O> UseCase<kotlin.Unit, O>.execute(): O
|
||||
|
||||
public final class Bar : UseCase<kotlin.Unit, kotlin.collections.List<kotlin.collections.List<kotlin.String>>> {
|
||||
public constructor Bar()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ fun execute(/*0*/ input: kotlin.Unit): kotlin.collections.List<kotlin.collections.List<kotlin.String>>
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Baz : UseCase<kotlin.Unit, kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.String>>>>>>> {
|
||||
public constructor Baz()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ fun execute(/*0*/ input: kotlin.Unit): kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.String>>>>>>
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo : UseCase<kotlin.Unit, kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.String>>>> {
|
||||
public constructor Foo()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ fun execute(/*0*/ input: kotlin.Unit): kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<kotlin.String>>>
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface UseCase</*0*/ in I, /*1*/ out O> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun execute(/*0*/ input: I): O
|
||||
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