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

Test for encodeToDynamic that passes null #2712

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

swankjesse
Copy link

No description provided.

@swankjesse
Copy link
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
Member

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

@swankjesse
Copy link
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
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.

3 participants