Describe the bug
On Kotlin version 1.3.41 and serialization 0.11.1, syntax and error highlighting in IntelliJ stop working properly on files which contain serializable types with members of 'typealias' types defined in an external module. However, the build still succeeds and all my serialization tests pass.
Also, when upgrading to Kotlin version 1.3.50 and serialization 0.13.0 this problem persists, but in addition IndexOutOfBoundsException is thrown during compilation of JavaScript targets. Therefore, I am currently not upgrading to serialization 0.13.0 just yet.
This latter specific case has been reported before (#527), but I bet these two errors are related so I created this overarching bug report.
To Reproduce
typealias of any @Serializable type in one module.@Serializable type in this second module containing a member of the 'typealias' type previously defined in the first module.You will notice that syntax highlighting for the typealias type does not work, and in general entire syntax and error highlighting in this file becomes broken. In addition, in case you target 1.3.50 and 0.13.0 the JS build will fail with an IndexOutOfBoundsException.
P.s.: I'm not certain this matters, but in my specific case I am creating a typealias for 'wildcard' types. I.e., typealias AnySomeType = SomeType<*,*> But, SomeType does not contain members of the type parameters; they are solely used in functions.
Expected behavior
Highlighting to work on Kotlin 1.3.41 and in addition for the build to succeed on Kotlin 1.3.50.
Environment
1.3.500.13.05.6.1Has anyone found a workound for this issue? This one and #527 are keeping us from upgrading from kotlin 1.3.31 to something more recent.
Removing all type-aliases from our codebase is not on option though.
Does this get fixed with kotlin 1.3.60 and 0.14?
I can't reproduce this anymore on Kotlin 1.3.60. Can anybody confirm this is fixed?
I'd say there is still a problem because of type parameters being unused in properties. Serialization plugin does not track that and still thinks that they require the substitution of serializers and therefore reports an error where a non-serializable type (e.g. Any? in case of star-projection) is encountered in usage of such typealias or class.
I can confirm. Just reintroduced all type aliases using Kotlin 1.3.60 and serialization 0.14.0 and project compiles for both JVM and JS target and all tests (including serialization) pass.
You can check the specific type aliases used in my revert commit: https://github.com/cph-cachet/carp.core-kotlin/commit/ac36f6ac4e8ceda5f9b064dc3216d8177971f7f1
Then I think I can close it now in favor of #607. If the bug happens again, please re-open with an attached reproducer.
Most helpful comment
Has anyone found a workound for this issue? This one and #527 are keeping us from upgrading from kotlin
1.3.31to something more recent.Removing all type-aliases from our codebase is not on option though.