[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:
Paulo Pinheiro
2020-06-23 02:08:35 +02:00
committed by GitHub
parent f35184aef9
commit 413bb9b553
4 changed files with 5 additions and 5 deletions

View File

@@ -146,7 +146,7 @@ class KotlinTest {
val monster = Monster.getRootAsMonster(bb)
assert(monster.testhashu32Fnv1 == (1u + Integer.MAX_VALUE.toUInt()))
assert(monster.testhashu32Fnv1 == (Integer.MAX_VALUE + 1L).toUInt())
}
fun TestNamespaceNesting() {
@@ -331,7 +331,7 @@ class KotlinTest {
Monster.addTest4(fbb, test4)
Monster.addTestarrayofstring(fbb, testArrayOfString)
Monster.addTestbool(fbb, true)
Monster.addTesthashu32Fnv1(fbb, UInt.MAX_VALUE + 1u)
Monster.addTesthashu32Fnv1(fbb, (Integer.MAX_VALUE + 1L).toUInt())
Monster.addTestarrayoftables(fbb, sortMons)
val mon = Monster.endMonster(fbb)