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

Complete strict concurrency checking fails to catch MainActor isolated init in an enum with associated value #76867

Open
tareksabry1337 opened this issue Oct 4, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@tareksabry1337
Copy link

tareksabry1337 commented Oct 4, 2024

Reproduction

enum GestureType {
    case tap(UITapGestureRecognizer = .init())
    case swipe(UISwipeGestureRecognizer = .init())
    case longPress(UILongPressGestureRecognizer = .init())
    case pan(UIPanGestureRecognizer = .init())
    case pinch(UIPinchGestureRecognizer = .init())
    case edge(UIScreenEdgePanGestureRecognizer = .init())
    
    func gestureRecognizer() -> UIGestureRecognizer {
        switch self {
        case .tap(let tapGesture):
            return tapGesture
            
        case .swipe(let swipeGesture):
            return swipeGesture
            
        case .longPress(let longPressGesture):
            return longPressGesture
            
        case .pan(let panGesture):
            return panGesture
            
        case .pinch(let pinchGesture):
            return pinchGesture
            
        case .edge(let edgePanGesture):
            return edgePanGesture
        }
    }
}

Expected behavior

The compiler should show a clear error message on where exactly the issue is, but it doesn't, it only shows an ambiguous error message

Screenshot 2024-10-04 at 18 39 00

On a more complicated projects, the error shows up on each and every file.

Removing .init() compiles successfully, Also marking GestureType as @mainactor doesn't help

Environment

swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx14.0

@tareksabry1337 tareksabry1337 added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant