Hi, I’m upgrading from 1.3.50 to 1.5.20 and I have...
# getting-started
m
Hi, I’m upgrading from 1.3.50 to 1.5.20 and I have this problem. This code now compiles
Copy code
class SomeClass<out T>(private val type: Class<T>, val getDefaultValue: () -> T) {
    constructor(type: Class<T>, default: T): this(type, {default})
}
but when I upgrade I have this error
Copy code
Kotlin: Overload resolution ambiguity: 
public constructor SomeClass<out T>(type: Class<TypeVariable(T)>, getDefaultValue: () -> TypeVariable(T)) defined in SomeClass
public constructor SomeClass<out T>(type: Class<TypeVariable(T)>, default: TypeVariable(T)) defined in SomeClass
can someone explain me why this doesn’t work anymore and/or how can I rewrite it?
e
intentional change to fix other errors in type inference
Copy code
class SomeClass<out T>(private val type: Class<T>, val getDefaultValue: () -> T) {
    constructor(type: Class<T>, default: T): this(type, getDefaultValue = { default })
}
will compile
m
perfect! 🙏