serebit
01/10/2019, 4:15 AMclass ReactMap : MutableMap<Long, MutableList<EmoteData>> by (mutableMapOf<Long, MutableList<EmoteData>>()
.withDefault { mutableListOf<EmoteData>() })
compiles fine, and
class ReactMap : MutableMap<Long, MutableList<EmoteData>> by mutableMapOf()
compiles fine, but
class ReactMap : MutableMap<Long, MutableList<EmoteData>> by (mutableMapOf().withDefault { mutableListOf() })
doesn't? Is it a bug in the compiler, or is it intentional?Dico
01/10/2019, 12:46 PMmutableMapOf()
invocation can't infer type arguments in the last example. It might work if you enable the improved type inference, but I'm not sure.serebit
01/10/2019, 5:31 PMDico
01/10/2019, 5:42 PMtasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf(
"-XXLanguage:+InlineClasses",
"-XXLanguage:+NewTypeInference",
"-Xuse-experimental=kotlin.Experimental"
)
}
}
-XXLanguage:+NewTypeInference