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

Deserialization of inline (value) classes should be properly handled #124

Closed
orchestr7 opened this issue Mar 15, 2022 · 0 comments · Fixed by #133
Closed

Deserialization of inline (value) classes should be properly handled #124

orchestr7 opened this issue Mar 15, 2022 · 0 comments · Fixed by #133
Assignees
Labels
bug Something isn't working
Milestone

Comments

@orchestr7
Copy link
Owner

Right now the following deserialisation is not supported:

class InlineDecoderTest {
    @JvmInline
    @Serializable
    value class Color(val rgb: Long)

    @Test
    fun testDecodingWithCustomSerializer() {
            Toml.decodeFromString<Color>(
            """
                rgb = 0
            """.trimIndent()
            )
    }
}

This happens, because of a missing implementation for public fun decodeInline(inlineDescriptor: SerialDescriptor): Decoder
method and invalid traversing of AST:

Invalid call to getNeighbourNodes() for TomlFile node
com.akuleshov7.ktoml.exceptions.InternalAstException: Invalid call to getNeighbourNodes() for TomlFile node
	at app//com.akuleshov7.ktoml.tree.TomlFile.getNeighbourNodes(TomlFile.kt:17)
	at app//com.akuleshov7.ktoml.decoders.TomlMainDecoder.getCurrentNode(TomlMainDecoder.kt:65)
	at app//com.akuleshov7.ktoml.decoders.TomlMainDecoder.decodeKeyValue$ktoml_core(TomlMainDecoder.kt:76)
	at app//com.akuleshov7.ktoml.decoders.TomlAbstractDecoder.decodeLong(TomlAbstractDecoder.kt:83)
@orchestr7 orchestr7 added the bug Something isn't working label Mar 15, 2022
@orchestr7 orchestr7 added this to the 0.2.12 milestone Mar 15, 2022
@orchestr7 orchestr7 self-assigned this Mar 15, 2022
@orchestr7 orchestr7 linked a pull request May 4, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant