Kotlin / kotlin-spec

Kotlin Language Specification:
https://kotlinlang.org/spec
Apache License 2.0
387 stars 80 forks source link

About "constructorInvocation" in KoltinParser.g4 #118

Closed lbtrace closed 1 year ago

lbtrace commented 1 year ago

Hi, I am Android developer from China, I using ANTLR4(using KotlinParser.g4 version v1.8) as kotlin AST library. And i find some confusion about "constructorInvocation".

belyaev-mikhail commented 1 year ago

Seems like a bug in the grammar to me

lbtrace commented 1 year ago

Hi @KvanTTT what do you think about this issue?

KvanTTT commented 1 year ago

I think the same: it looks like a bug in the grammar.

lbtrace commented 1 year ago

Thanks for replay @belyaev-mikhail @KvanTTT So, maybe we should modify constructorInvocation like this:

constructorInvocation
    : userType NL* valueArguments
    ;

Do you know who can determine these things?

ice-phoenix commented 1 year ago

Yeah, that's definitely a bug, thanks for bringing it to our attention! We'll do our best to fix it in the spec 1.9 release.

drieks commented 1 year ago

Hi @lbtrace, Kotlin Studio is not using KotlinParser.g4. In kotlinx.ast, we have own copy of this file. But sadly, I still have to fix the build system. If you can use a local build version for kotlinx.ast, you can fix it locally:

https://github.com/kotlinx/ast/blob/master/grammar-kotlin-parser-common/src/commonAntlr/antlr/KotlinParser.g4#L97

constructorInvocation
    : userType NL* valueArguments
    ;
lbtrace commented 1 year ago

Yes, I will fix it locally, thanks for your suggestion

ice-phoenix commented 1 year ago

Fixed in a94315649ae44453d6e0a639d4de1a586c8176e2, soon to be released in version 1.9