If I have ``` sealed class Foo<T:Any> { ob...
# announcements
k
If I have
Copy code
sealed 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?
n
Would this work?
Copy code
fun String.convert2() = this.let{Foo.Baz(it)}
m
You could try
Foo<*>::Baz
, and I believe it should work as expected