Asq
04/09/2022, 1:06 PMdmitriy.novozhilov
04/11/2022, 5:59 AMby
keyword, and infix call of function is also expression
2. where
is soft keyword, which means it parses like keyword only in specific context (after supertypes list and before body of class). In other contexts where
is parsed as regular modifier
This all leads to situation from your example and it's more or less expected
As it was suggested in in original thread, there is a workaround with additional newline (\n
in this case assumed as end of expression)
Also if where
were harder keyword then such code (esoteric, but still meaningful) will be impossible to write:
interface A
infix fun String.where(other: String): A = TODO()
const val B = "B"
const val C = "C"
class Impl<T> : A by B where C // `where` us call of function
where T : CharSequence // `where` is keyword
Asq
04/12/2022, 1:47 PM