Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructor parameters and properties defined in constructor #1

Closed
martinflorek opened this issue Oct 18, 2019 · 6 comments
Closed

Comments

@martinflorek
Copy link

The parser now handles "escaped" characters inside annotations' values but I have found another missing node.

The AST does not contain constructor parameters and properties declared in constructor e.g.:

class TestClass(
    @Value("test value")
    private val propertyA: String
)
@drieks
Copy link
Collaborator

drieks commented Oct 18, 2019

Hi @martinflorek, please try Version 4f20128eaf.

I removed KlassArgument and the constructor is now reported as KlassDeclaration(constructor), including all arguments (also of type KlassDeclaration)

You can find the new AST structure of your test case here: https://github.com/kotlinx/ast/blob/4f20128eaf4d5d59b6c68448bfa53c266c823eec/kotlin/src/commonTest/resources/testdata/ConstructorParametersAndProperties.summary.txt

@drieks drieks reopened this Oct 21, 2019
@martinflorek
Copy link
Author

Now all my tests are crashing on calling summary() i.e. KotlinAstParser.parseKotlinFile(source).summary() throws java.lang.UnsupportedOperationException: Empty collection can't be reduced..

Parsing anything leads to a new structure and summary() does not work anymore...

@martinflorek
Copy link
Author

Sorry, this is not true. The constructor works OK and I have other special case that is causing the crash with summary(). I will try to isolate it into a small test case.

@drieks
Copy link
Collaborator

drieks commented Oct 21, 2019

Hi @martinflorek, can you provide a stacktrace? Or a small kotlin file example causing this?

All unit tests included in kotlinx.ast are working fine, I think you have something in your kotlin files that is not included in the tests.

I will add a test that tries to parse https://github.com/arrow-kt/arrow to find the bug this evening (I'm living in Germany, currently GMT+2)

@martinflorek
Copy link
Author

I have added a minimalistic example in #2 that leads to weird AST structure which crashes after calling summary() on it.

@drieks
Copy link
Collaborator

drieks commented Nov 6, 2019

I think this issue is resolved now, like #2.

@drieks drieks closed this as completed Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants