class Generic(val value: T) { fun foo(): T = value } fun test(arg: Generic) { val value = arg.value val foo = arg.foo() val length = foo.length + value.length }