Skip to content

Test for encodeToDynamic that passes null#2712

Open
swankjesse wants to merge 1 commit intoKotlin:masterfrom
swankjesse:jwilson.0611.dynamic_null
Open

Test for encodeToDynamic that passes null#2712
swankjesse wants to merge 1 commit intoKotlin:masterfrom
swankjesse:jwilson.0611.dynamic_null

Conversation

@swankjesse
Copy link
Copy Markdown

No description provided.

@swankjesse
Copy link
Copy Markdown
Author

This test fails like so:

UninitializedPropertyAccessException: lateinit property current has not been initialized
	at <global>.throwUninitializedPropertyAccessException(/Volumes/Development/kotlinx.serialization/formats/json-tests/build/compileSync/js/test/testDevelopmentExecutable/kotlin/js/runtime/hacks.kt:10)
	at <global>._get_current__qcrdxk(/Volumes/Development/kotlinx.serialization/formats/json/jsMain/src/kotlinx/serialization/json/internal/DynamicEncoders.kt:56)
	at DynamicObjectEncoder.protoOf.encodeNull_ejiosz(/Volumes/Development/kotlinx.serialization/formats/json/jsMain/src/kotlinx/serialization/json/internal/DynamicEncoders.kt:112)
	at NullableSerializer.protoOf.serialize_k0t1hm(/Volumes/Development/kotlinx.serialization/core/commonMain/src/kotlinx/serialization/internal/NullableSerializer.kt:25)
	at NullableSerializer.protoOf.serialize_5ase3y(kotlin/kotlinx-serialization-kotlinx-serialization-core.js:3995)
	at DynamicObjectEncoder.protoOf.encodeSerializableValue_3uuzip(/Volumes/Development/kotlinx.serialization/formats/json/commonMain/src/kotlinx/serialization/json/internal/Polymorphic.kt:46)
	at <global>.encodeToDynamic(/Volumes/Development/kotlinx.serialization/formats/json/jsMain/src/kotlinx/serialization/json/internal/DynamicEncoders.kt:42)
	at <global>.encodeToDynamic(/Volumes/Development/kotlinx.serialization/formats/json/jsMain/src/kotlinx/serialization/json/Dynamics.kt:65)
	at EncodeToDynamicTest.protoOf.dynamicNull_lzm55i(/Volumes/Development/kotlinx.serialization/formats/json-tests/jsTest/src/kotlinx/serialization/json/EncodeToDynamicTest.kt:130)
	at <global>.fn(kotlin/kotlinx-serialization-kotlinx-serialization-json-tests-test.js:84611)
	at Context.<anonymous>(/Volumes/Development/kotlinx.serialization/build/js/packages_imported/kotlin-test-js-runner/src/KotlinTestTeamCityConsoleAdapter.ts:70)
	at <global>.processImmediate(node:internal/timers:478)

@sandwwraith
Copy link
Copy Markdown
Member

Hi! Did I understand correctly that you do not have a proposed fix and these tests only illustrate the problem?

@swankjesse
Copy link
Copy Markdown
Author

If you give me the green light I’ll fix it too. I didn’t wanna do that work if you thought this was working as designed.

@sandwwraith
Copy link
Copy Markdown
Member

No, it wasn't designed to reject null, so I'll gladly accept your fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants