https://kotlinlang.org logo
#announcements
Title
# announcements
j

jstuyts-squins

09/21/2017, 12:42 PM
I think Kotlin sees the former as, i.e. as 2 declarations: companion object without members and a property:
Copy code
companion object
val yo = "yo"
u

uli

09/21/2017, 2:50 PM
Which seems like a compiler bug to me. Wouldn't the language spec require a
;
inbetween?
j

jstuyts-squins

09/22/2017, 5:56 AM
I don't think so. There are only a very few places where semicolons are needed. There is no ambiguity from the perspective of the compiler. The companion object declaration is complete: no
{
following
companion object
, so a new declaration can be started immediatly
u

uli

09/23/2017, 10:08 AM
Typically a statement is ended by a SEMI token which is defined to be semicolon or new line: https://kotlinlang.org/docs/reference/grammar.html#SEMI As i am on my phone, i have not checked if this is true for object declarations