I am trying to use unsigned types in Kotlin. I am using kotlin verison 1.4.32
I have added the compiler option -Xuse-experimental=kotlin.ExperimentalUnsignedTypes
as specified in the documentation.
but I am getting this error: Type of the constant expression cannot be resolved. Please make sure you have the required dependencies for unsigned types in the classpath
tried the answers here with no luck.
here is my code
@ExperimentalUnsignedTypes
enum class Status(val value: UByte) {
None(0x00u)
}
I have now inside build.gradle file
allprojects {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += [
"-Xuse-experimental=kotlin.ExperimentalUnsignedTypes",
"-XXLanguage:+InlineClasses"
]
}
}
}
Am I missing something?