You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting generateAsync.set(true) in the gradle configuration, .sq files containing grouped statements which return a result, the compiled ExecutableQuery throws a compilation error:
Type mismatch: inferred type is QueryResult<R> but R was expected
An example grouped statement that would cause this issue:
privateinnerclassInsertResultQuery<outT:Any>(
publicvalbatch_test_id:Long,
publicvalstatus:String?,
mapper: (SqlCursor) ->T,
) : ExecutableQuery<T>(mapper) {
overridefun <R> execute(mapper: (SqlCursor) ->QueryResult<R>): QueryResult<R> =QueryResult.AsyncValue {
transactionWithResult {
driver.execute(-522_152_271, """ |INSERT INTO result(batch_test_id, status) |VALUES(?, ?)""".trimMargin(), 2) {
bindLong(0, batch_test_id)
bindString(1, status)
}.await()
// it is at the line below that has the compile error of// Type mismatch: inferred type is QueryResult<R> but R was expected
driver.executeQuery(-522_152_270, """SELECT last_insert_rowid()""", mapper, 0)
}
}
overridefuntoString(): String="Result.sq:insertResult"
}
Stacktrace
Type mismatch: inferred type is QueryResult<R> but R was expected
Gradle Build Script
importorg.jetbrains.kotlin.gradle.tasks.KotlinCompileplugins {
kotlin("jvm") version "1.8.22"
application
id("app.cash.sqldelight") version "2.0.0-rc02"
id("org.jetbrains.kotlinx.dataframe") version "0.11.0"
}
group ="com.example"
version ="1.0-SNAPSHOT"sqldelight {
databases {
create("Database") {
packageName.set("com.example.data")
generateAsync.set(true)
deriveSchemaFromMigrations.set(false)
verifyMigrations.set(false)
version =1
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.jetbrains.kotlinx:dataframe:0.11.0")
implementation("org.jetbrains.kotlinx:kotlinx-cli-jvm:0.3.5")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2")
implementation("org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.4.0")
implementation("app.cash.sqldelight:sqlite-driver:2.0.0-rc02")
implementation("app.cash.sqldelight:coroutines-extensions:2.0.0-rc02")
implementation("app.cash.sqldelight:primitive-adapters:2.0.0-rc02")
implementation("com.squareup.okhttp3:logging-interceptor:4.10.0")
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
implementation(platform("io.arrow-kt:arrow-stack:1.2.0"))
implementation("io.arrow-kt:arrow-core")
implementation("io.arrow-kt:arrow-fx-coroutines")
implementation("io.arrow-kt:arrow-core-retrofit")
}
repositories {
mavenCentral()
}
application {
mainClass.set("MainKt")
}
The text was updated successfully, but these errors were encountered:
This is definitely a bug and will be fixed. That being said, based on your gradle configuration you're targeting the JVM with the SQLite dialect which isn't a setup where you need to (or should) use generateAsync. Unless you plan to target Kotlin/JS where async drivers are needed, I would recommend not using generateAsync.
SQLDelight Version
2.0.0-rc02
Operating System
Mac OS
Gradle Version
gradle-7.6.1-bin
Kotlin Version
1.8.22
Dialect
sqlite
AGP Version
No response
Describe the Bug
When setting
generateAsync.set(true)
in the gradle configuration, .sq files containing grouped statements which return a result, the compiled ExecutableQuery throws a compilation error:An example grouped statement that would cause this issue:
Generated code by SqlDelight:
Stacktrace
Gradle Build Script
The text was updated successfully, but these errors were encountered: