Michael Krussel
06/02/2025, 6:43 PMclassDeclaration (used by declaration)
: modifiers? ('class' | ('fun'? 'interface'))
simpleIdentifier typeParameters?
primaryConstructor?
(':' delegationSpecifiers)?
typeConstraints?
(classBody | enumClassBody)?
;
I would expect this to work, but it doesn't
class Foo<T>(t: T, bar: Bar) : Bar by bar where T: T1, T : T2 {}
I've tried a few variants, adding commas or colon between the by bar and the where. If I remove the by
it compiles.Youssef Shoaib [MOD]
06/02/2025, 6:55 PMwhere
. It's maybe a compiler bug thus and not an issue with the grammarMichael Krussel
06/02/2025, 6:55 PMephemient
06/02/2025, 8:13 PMephemient
06/02/2025, 8:16 PMephemient
06/02/2025, 8:17 PMwhere
is a soft keyword so it is only recognized specifically in contexts where it is expected, so the delegation expression just consumes it like a normal identifier (and then breaks)Klitos Kyriacou
06/03/2025, 12:48 PMephemient
06/03/2025, 12:52 PM