mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-27 23:28:06 +00:00
[Kotlin] Fix Access to union of vector element (#5994)
Kotlin code generation was producing wrong logic for accessors of vector of union elements. This was shadowed by the fact[1] that asserts in Kotlin are silently ignored unless the flag "-ea" is passed to the JVM. The tests are also updated to enable asserts. 1 - https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/assert.html
This commit is contained in:
@@ -58,7 +58,7 @@ class Movie : Table() {
|
||||
fun characters(obj: Table, j: Int) : Table? {
|
||||
val o = __offset(10)
|
||||
return if (o != 0) {
|
||||
__union(obj, __vector(o) + j * 4 - bb_pos)
|
||||
__union(obj, __vector(o) + j * 4)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user