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

ghedeon

01/19/2020, 12:51 PM
Do I miss something or type inference is confused here? A. Works
Copy code
interface I

class Main : Base<MainParam<*>>
class MainParam<T : I> : BaseParam

interface Base<T : BaseParam>
interface BaseParam
B. Doesn't (
Type argument is not within its bounds
)
Copy code
interface I

class Main : Base<Main.MainParam<*>> {
    class MainParam<T : I> : BaseParam
}

interface Base<T : BaseParam>
interface BaseParam
n

nikolaymetchev

01/20/2020, 12:49 AM
In java you would probably have to declare MainParam as a static class to get this to work. Kotlin I don’t think has static classes. You could try declaring MainParam in the companion object.
g

ghedeon

01/20/2020, 8:44 AM
Seems like a bug, similar to https://youtrack.jetbrains.com/issue/KT-29743. Will wait for confirmation
s

Sergei Dubrov [JB]

01/20/2020, 12:04 PM
Thank you! Added your case to KT-29743.
🙏 1
3 Views