Skip to content

Conversation

@kntkymt
Copy link
Contributor

@kntkymt kntkymt commented Apr 1, 2024

Pull Request Type

  • Bug fix
  • New feature
  • Refactoring
  • Documentation update
  • Chore

Issue for this PR

Nothing

Environment

xcodebuild -version 
Xcode 15.3
Build version 15E204a

swift --version
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0

Description

I encountered below warning at main branch.

スクリーンショット 2024-04-02 1 48 18

Main actor-isolated class 'AtomViewContextTests' has different actor isolation from nonisolated superclass 'XCTestCase'; this is an error in Swift 6

Motivation and Context

I'd like to suppress warning. (It will be error on Swift 6, we have to fix it.)

Detail Information

This swift specification might exist from Swift 5.5, According to the statement in SE0316.

A class can only be annotated with a global actor if it has no superclass, the superclass is annotated with the same global actor, or the superclass is NSObject. A subclass of a global-actor-annotated class must be isolated to the same global actor.

However, above warning exist since swift 5.10.

What I did

  • I moved @MainActor attribute from XCTestCase to its functions for all tests.
  • Fix README.md.

Impact on Existing Code

  • Nothing for Sources code
  • A little for Tests code (the isolation behavior on testing code might change?)

Screenshot/Video/Gif

Copy link
Contributor Author

@kntkymt kntkymt Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't add @MainActor to a few functions like testKey since it does not require @MainActor.
What do you think? Should I add @MainActor to preserve current (main branch) isolation behavior?

func testEmptyGraphDescription() {

@ra1028
Copy link
Owner

ra1028 commented Apr 2, 2024

@kntkymt
Thanks! Let me investigate it for a bit to know what exactly happens and community direction, and then merge it afterward.

Copy link
Collaborator

@rasberik rasberik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked with same environment, looks good. There are few other warnings in StoreContext, but those better be addressed separately

Copy link
Owner

@ra1028 ra1028 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed by @rasberik . Thanks.

@ra1028 ra1028 merged commit 5eeec4f into ra1028:main Apr 4, 2024
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.

3 participants