Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to fix actor warnings? #6

Open
lexum0 opened this issue Nov 22, 2024 · 3 comments
Open

How to fix actor warnings? #6

lexum0 opened this issue Nov 22, 2024 · 3 comments

Comments

@lexum0
Copy link

lexum0 commented Nov 22, 2024

There's lots of warnings about Skip is unable to match this API call to determine the correct actor on which to run it. Consider adding additional type information

Is there any documentation on how to deal with them?

@aabewhite
Copy link
Contributor

Is this when calling API from a third party library?

If the code is only for Android (i.e. in #if SKIP blocks), you can actually omit "await" altogether since Kotlin doesn't need it, and Skip will stop complaining. Otherwise you can put "// SKIP NOWARN" on the offending lines to silence warnings

@lexum0
Copy link
Author

lexum0 commented Jan 10, 2025

I finally removed enough errors to deal with this warning.

It shows up when calling a variadic parameter function without any parameters. Here's a sample code to test it

struct Country: Codable, Hashable {
  let id: Int
  let name: String
}
extension Country {
    static func query() async throws -> Country {
        Country(id: 0, name: "")
    }
    static func queryVariadic(id: Int...) async throws -> Country {
        Country(id: 0, name: "")
    }
    
    func warningTest() {
        Task.detached {
            let _ = try? await Country.query()
            let _ = try? await Country.queryVariadic() // <- triggers the warning
            let _ = try? await Country.queryVariadic(id: 0)
        }
    }
}

I'll add the "NOWARN" comment to silence the warnings for now

@lexum0
Copy link
Author

lexum0 commented Jan 10, 2025

This warning also shows up when calling the skip-supabase library.
Simply opening the library gives 30+ warnings, both in the SkipSupabase.swift library implementation and the tests (https://github.com/skiptools/skip-supabase/blob/main/Tests/SkipSupabaseTests/SkipSupabaseTests.swift)

When it's imported in a relatively simple app it causes hundreds of warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants