Skip to content

Conversation

@souma987
Copy link
Contributor

fixes #8419

Updates GenStructBody to use the namer for correct casing. Previously, the body used raw field names instead of the camelCase parameters.

Generated Kotlin code for the schema in the issue with this fix applied
@Suppress("unused")
class Second : Struct() {

    fun __init(_i: Int, _bb: ByteBuffer)  {
        __reset(_i, _bb)
    }
    fun __assign(_i: Int, _bb: ByteBuffer) : Second {
        __init(_i, _bb)
        return this
    }
    val opFirst : First? get() = opFirst(First())
    fun opFirst(obj: First) : First? = obj.__assign(bb_pos + 0, bb)
    companion object {
        fun createSecond(builder: FlatBufferBuilder, opFirst_first: UShort) : Int {
            builder.prep(2, 2)
            builder.prep(2, 2)
            builder.putShort(opFirst_first.toShort())
            return builder.offset()
        }
    }
}

@github-actions github-actions bot added c++ codegen Involving generating code from schema kotlin labels Dec 14, 2025
@jtdavis777 jtdavis777 enabled auto-merge (squash) December 14, 2025 23:54
@jtdavis777 jtdavis777 merged commit a86afae into google:master Dec 14, 2025
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema kotlin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Kotlin] parameter name isn't the same as its usage in struct

2 participants