Skip to content

Conversation

@hborla
Copy link
Member

@hborla hborla commented Sep 9, 2023

Fixes an issue where a nonisolated initializer of a subclass could invoke global-actor-isolated properties in the superclass:

@MainActor
func mainFn() { ... }

@MainActor
class Parent {
  var x: Int = 0 {
    didSet { mainFn() }
  }

  nonisolated init() {}
}

class Child: Parent {
  override nonisolated init() {
    super.init()
    super.x = 10 // this should be an error!
  }
}

The first commit of this change also renames Independent to Nonisolated throughout the actor isolation checker.

Resolves rdar://86550653

…nt'.

This commit is NFC; it's mostly renames.
…ties

from nonisolated subclass initializers.
@hborla
Copy link
Member Author

hborla commented Sep 9, 2023

@swift-ci please smoke test

@hborla hborla merged commit e23e4c3 into swiftlang:main Sep 9, 2023
@hborla hborla deleted the nonisolated-init-hole branch September 9, 2023 16:55
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

Successfully merging this pull request may close these issues.

1 participant