// KT-5508 Stackoverflow in type substitution abstract class A { public abstract fun foo(x: T) public abstract fun bar(x: T) public inner abstract class B : A>() { public inner class C : B>() { // Here B> means A.B>.B.B.C>>.B.B>.B.B.C>.C> // while for being a correct override it should be A.B>.B.B.C> // It happens because at the beginning we search implicit arguments for an outer classes through supertypes // See TypeResolver.computeImplicitOuterClassArguments for clarifications override fun foo(x: B>) { throw UnsupportedOperationException() } override fun bar(x: A.B>.B.B.C>) { throw UnsupportedOperationException() } } } }