Skip to content

JsonArrayBuilder's unaryPlus extensions don't work for Number? #418

@jcayzac

Description

@jcayzac

Using kotlinx-serialization-runtime:0.10.0 the following code produces an empty array:

jsonArray {
    +2
    +4
    +6
    +8
}

Being more verbose works as expected:

jsonArray {
    +JsonPrimitive(2)
    +JsonPrimitive(4)
    +JsonPrimitive(6)
    +JsonPrimitive(8)
}

It seems that https://github.com/Kotlin/kotlinx.serialization/blob/master/runtime/common/src/test/kotlin/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt lacks tests for the the unaryPlus overloads defined in JsonArrayBuilder, maybe.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions