Skip to content

Compile error on macOS 12.2.1 #167

@valeriyvan

Description

@valeriyvan
Contributor
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:9:30: error: 'UnownedJob' is only available in macOS 10.15 or newer
    fileprivate var headJob: UnownedJob? = nil
                             ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:8:8: note: add @available attribute to enclosing struct
struct QueueState: Sendable {
       ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:15:37: error: 'UnownedJob' is only available in macOS 10.15 or newer
    func insertJobQueue(job newJob: UnownedJob) {
                                    ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:15:10: note: add @available attribute to enclosing instance method
    func insertJobQueue(job newJob: UnownedJob) {
         ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:13:1: note: add @available attribute to enclosing extension
extension JavaScriptEventLoop {
^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:49:34: error: 'UnownedJob' is only available in macOS 10.15 or newer
    func claimNextFromQueue() -> UnownedJob? {
                                 ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:49:10: note: add @available attribute to enclosing instance method
    func claimNextFromQueue() -> UnownedJob? {
         ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:13:1: note: add @available attribute to enclosing extension
extension JavaScriptEventLoop {
^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:69:48: error: 'UnownedJob' is only available in macOS 10.15 or newer
    func nextInQueue() -> UnsafeMutablePointer<UnownedJob?> {
                                               ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:69:10: note: add @available attribute to enclosing instance method
    func nextInQueue() -> UnsafeMutablePointer<UnownedJob?> {
         ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:58:13: note: add @available attribute to enclosing extension
fileprivate extension UnownedJob {
            ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:58:23: error: 'UnownedJob' is only available in macOS 10.15 or newer
fileprivate extension UnownedJob {
                      ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:58:13: note: add @available attribute to enclosing extension
fileprivate extension UnownedJob {
            ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:17:48: error: 'UnownedJob' is only available in macOS 10.15 or newer
            var position: UnsafeMutablePointer<UnownedJob?> = headJobPtr
                                               ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:17:48: note: add 'if #available' version check
            var position: UnsafeMutablePointer<UnownedJob?> = headJobPtr
                                               ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:15:10: note: add @available attribute to enclosing instance method
    func insertJobQueue(job newJob: UnownedJob) {
         ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:13:1: note: add @available attribute to enclosing extension
extension JavaScriptEventLoop {
^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:71:84: error: 'UnownedJob' is only available in macOS 10.15 or newer
            let nextJobPtr = UnsafeMutableRawPointer(rawNextJobPtr).bindMemory(to: UnownedJob?.self, capacity: 1)
                                                                                   ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:71:84: note: add 'if #available' version check
            let nextJobPtr = UnsafeMutableRawPointer(rawNextJobPtr).bindMemory(to: UnownedJob?.self, capacity: 1)
                                                                                   ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:69:10: note: add @available attribute to enclosing instance method
    func nextInQueue() -> UnsafeMutablePointer<UnownedJob?> {
         ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JobQueue.swift:58:13: note: add @available attribute to enclosing extension
fileprivate extension UnownedJob {
            ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:81:33: error: 'UnownedJob' is only available in macOS 10.15 or newer
    private func enqueue(_ job: UnownedJob, withDelay nanoseconds: UInt64) {
                                ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:81:18: note: add @available attribute to enclosing instance method
    private func enqueue(_ job: UnownedJob, withDelay nanoseconds: UInt64) {
                 ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:6:20: note: add @available attribute to enclosing class
public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
                   ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:88:32: error: 'UnownedJob' is only available in macOS 10.15 or newer
    public func enqueue(_ job: UnownedJob) {
                               ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:88:17: note: add @available attribute to enclosing instance method
    public func enqueue(_ job: UnownedJob) {
                ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:6:20: note: add @available attribute to enclosing class
public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
                   ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:92:46: error: 'UnownedSerialExecutor' is only available in macOS 10.15 or newer
    public func asUnownedSerialExecutor() -> UnownedSerialExecutor {
                                             ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:92:17: note: add @available attribute to enclosing instance method
    public func asUnownedSerialExecutor() -> UnownedSerialExecutor {
                ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:6:20: note: add @available attribute to enclosing class
public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
                   ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:60:73: error: 'UnownedJob' is only available in macOS 10.15 or newer
        typealias swift_task_enqueueGlobal_hook_Fn = @convention(thin) (UnownedJob, swift_task_enqueueGlobal_original) -> Void
                                                                        ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:57:24: note: add @available attribute to enclosing static method
    public static func installGlobalExecutor() {
                       ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:6:20: note: add @available attribute to enclosing class
public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
                   ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:66:90: error: 'UnownedJob' is only available in macOS 10.15 or newer
        typealias swift_task_enqueueGlobalWithDelay_hook_Fn = @convention(thin) (UInt64, UnownedJob, swift_task_enqueueGlobalWithDelay_original) -> Void
                                                                                         ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:57:24: note: add @available attribute to enclosing static method
    public static func installGlobalExecutor() {
                       ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:6:20: note: add @available attribute to enclosing class
public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
                   ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:72:79: error: 'UnownedJob' is only available in macOS 10.15 or newer
        typealias swift_task_enqueueMainExecutor_hook_Fn = @convention(thin) (UnownedJob, swift_task_enqueueMainExecutor_original) -> Void
                                                                              ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:57:24: note: add @available attribute to enclosing static method
    public static func installGlobalExecutor() {
                       ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:6:20: note: add @available attribute to enclosing class
public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
                   ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:93:16: error: 'UnownedSerialExecutor' is only available in macOS 10.15 or newer
        return UnownedSerialExecutor(ordinary: self)
               ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:93:16: note: add 'if #available' version check
        return UnownedSerialExecutor(ordinary: self)
               ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:92:17: note: add @available attribute to enclosing instance method
    public func asUnownedSerialExecutor() -> UnownedSerialExecutor {
                ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:6:20: note: add @available attribute to enclosing class
public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
                   ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:101:23: error: 'withUnsafeThrowingContinuation' is only available in macOS 10.15 or newer
            try await withUnsafeThrowingContinuation { [self] continuation in
                      ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:101:23: note: add 'if #available' version check
            try await withUnsafeThrowingContinuation { [self] continuation in
                      ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:99:9: note: add @available attribute to enclosing property
    var value: JSValue {
        ^
/Users/xxxxxxxxxx/Documents/JavaScriptKit/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift:97:8: note: add @available attribute to enclosing extension
public extension JSPromise {
       ^

Activity

kateinoigakukun

kateinoigakukun commented on Feb 22, 2022

@kateinoigakukun
Member

First of all, this package won't support macOS, and I don't think this error could happen in application development targeting wasm.

MaxDesiatov

MaxDesiatov commented on Feb 23, 2022

@MaxDesiatov
Contributor

I wonder if we should provide some stubs on macOS to at least make code completion work if someone imports JavaScriptEventLoop module?

filip-sakel

filip-sakel commented on Mar 12, 2022

@filip-sakel

Finding a solution would be greatly appreciated. I edit my code on Xcode so I find it really hard to have to comment out the dependency to get actual diagnostics and then uncomment to run with carton.

Jomy10

Jomy10 commented on Mar 17, 2022

@Jomy10

Maybe we could add .platforms(.macos(.v10_15)) to the Package.swift or we could add @available(macOS 10.15, *) to the classes in JavaScriptEventLoop. I have done this for my local copy, because the documentation would not build otherwise.

I can work on this if we decide on which of the approaches to go for?

Edit: I see a pull request has already been opened

kateinoigakukun

kateinoigakukun commented on Mar 24, 2022

@kateinoigakukun
Member

I couldn't figure out a feasible solution to improve development experience with Xcode, so adding availability guards is reasonable to me now. Sorry for taking a long time.

filip-sakel

filip-sakel commented on Mar 24, 2022

@filip-sakel

No worries; glad it’s fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @MaxDesiatov@valeriyvan@kateinoigakukun@filip-sakel@Jomy10

      Issue actions

        Compile error on macOS 12.2.1 · Issue #167 · swiftwasm/JavaScriptKit