Kroppeb
10/28/2019, 10:19 PMsealed class Foo<T:Any> {
object Bar : Foo<Nothing>()
class Baz(val p: String) : Foo<String>()
// I can do this
fun String.convert() = this.let(::Baz)
}
// One type argument expected for class Foo<T : Any>
fun String.convert2() = this.let(Foo::Baz)
typealias FooBaz = Foo.Baz
fun String.convert3() = this.let(::FooBaz)
I get an error if i try Foo::Baz
but adding a type makes Baz
an unresolved reference. The code does work if all generics are removed. Can I fix this without import statements?Nate
10/28/2019, 10:40 PMfun String.convert2() = this.let{Foo.Baz(it)}
Marat Akhin
10/29/2019, 10:15 AMFoo<*>::Baz
, and I believe it should work as expected