-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Description
The code fails to compile due to it missing a period '.' or the full definition (period and the struct it belongs to). e.g. Typing .id will be transpiled as 'id' instead of Country.CodingKeys.id, causing different errors since it doesn't exist.
The problem only seems to appear in a try call when the function throws.
Functions like update() and insert() produce the error, while select() works correctly, as the following test shows:
Test
- Add the following code at the bottom of the ContentView file in the SupaTODO project
https://github.com/skiptools/skipapp-supatodo/blob/main/Sources/SupaTODO/ContentView.swift
func test1() throws -> PostgrestFilterBuilder {
supabase
.from("table")
.select() // select works
.eqCol(.name, value: "") // ✅
}
func test2() throws -> PostgrestFilterBuilder {
try! supabase
.from("table")
.update("") // update doesn't work
// .eqCol(Key.name, value: "") // works
.eqCol(.name, value: "") // ❌ <- Transpiler error: '.' is missing in the transpiled code (in the .kt file)
}
func test3() throws -> PostgrestFilterBuilder {
try! supabase
.from("table")
.insert("") // insert doesn't work
.eqCol(Key.name, value: "") // works
// .eqCol(.name, value: "") // ❌ <- Transpiler error: '.' is missing in the transpiled code (in the .kt file)
}
enum Key: String {
case id,
name
}
extension PostgrestFilterBuilder {
func eqCol(_ column: Key,
value: String) -> PostgrestFilterBuilder {
eq(column.rawValue, value: value)
}
}
-
Compile the project and open the transpiled ContentView.kt file.
The transpiled code will show.eqKey(nameinstead of.nameorKey.name_ -
Uncomment the previous line to see it work correctly
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels