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

Experimental support for inline classes #1244

Merged
merged 22 commits into from
Jan 28, 2021
Merged

Experimental support for inline classes #1244

merged 22 commits into from
Jan 28, 2021

Conversation

sandwwraith
Copy link
Member

  • Support for @Serializable inline class with generated (requires 1.4.30 IR compiler) and custom serializers
  • Standard serializers for UInt, ULong, UByte and UShort
  • For both streaming and tree Json

Copy link
Contributor

@shanshin shanshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It currently supports unsigned types only for JSON format.


```kotlin
object UIDSerializer: KSerializer<UID> {
override val descriptor = UInt.serializer().descriptor
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we lack analogue of PrimitiveClassDescriptor

import kotlin.test.*

@Serializable
data class SimpleContainerForUInt(val i: UInt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These classes can be moved into InlineClassesTest, can't they?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Inline classes are only allowed on top level' says Kotlin compiler

Copy link
Member

@qwwdfsad qwwdfsad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, great job!

sandwwraith and others added 3 commits January 28, 2021 21:08
…l/TreeJsonEncoder.kt

Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
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

Successfully merging this pull request may close these issues.

3 participants