ansman
04/21/2025, 11:59 PMfun foo(content: context(String, String) () -> Unit) {
content("", "")
}
fun test() {
foo {
// Does not work: Multiple potential context arguments for 'String' in scope.
implicit<String>()
}
}
Youssef Shoaib [MOD]
04/22/2025, 12:01 AMansman
04/22/2025, 12:02 AMYoussef Shoaib [MOD]
04/22/2025, 12:06 AMansman
04/22/2025, 12:18 AMYoussef Shoaib [MOD]
04/22/2025, 12:21 AMansman
04/22/2025, 12:24 AMAlejandro Serrano.Mena
04/22/2025, 6:12 AMcontext(A, B) () -> Unit
for generic A
and B
makes sense in general. If we were to prohibit context(String, String) () -> Unit
we would need to prohibit the generic one too (since it can be instantiated to A = B = String
).
Since we think the case of several generic distinct parameters is useful in general, we've decided to allow this (and the String,String case as a consequence), and move the "check" about whether it makes sense to the use site (that is, to the moment you try to fetch one of those context parameters)Youssef Shoaib [MOD]
04/22/2025, 6:36 AMAlejandro Serrano.Mena
04/22/2025, 6:41 AM