https://kotlinlang.org logo
#announcements
Title
# announcements
s

supaham

06/16/2017, 2:54 AM
If I have
Copy code
class Bar
class Baz: Bar
class Foo<T: Bar>() {
  fun input(t: T)
  fun returnT(): T
}
Then
Copy code
class Other(val foo: Foo<Bar>)
class Impl(foo: Foo<Baz>): Other(foo)
Impl generates:
[TYPE_MISMATCH] Type mismatch: inferred type is Foo<Baz> but Foo<Bar> was expected
How can I overcome this issue?
g

gildor

06/16/2017, 5:04 AM
supaham: Something like: class Foo<out T: Bar> { fun input(t: @UnsafeVariance T) fun returnT(): T }
👍 2
3 Views