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

[SR-15656] Compiler crashes when accessing a constant declared within an actor #57935

Open
TheHarcker opened this issue Dec 23, 2021 · 0 comments
Open

Comments

@TheHarcker
Copy link
Contributor

@TheHarcker TheHarcker commented Dec 23, 2021

Previous ID SR-15656
Radar None
Original Reporter @TheHarcker
Type Bug

Attachment: Download

Environment

"Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)" bundled with Xcode 13.2 (13C90)

MacOS 12.1 (21C52) running on Apple Silicon

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 290caef4f2e957816cbee165e1cb13cc

Issue Description:

When accessing a constant member of an actor defined within another module, the Swift compiler crashes.

The attached project contains two modules: "dependency" in which an actor "A" with a constant member is declared, and "SwiftCrash" which depends on "dependency" and uses "A" within an async function.

Expected behaviour

The expected declaration of said function:

func aFunction(a: A) -> String{    
    return a.requiredString
} 

Which compiles as long as "A" is defined within the same module.

When "A" is defined within another module, the compiler will throw one of the following errors depending on whether "aFunction" is async:

Sync:

actor-isolated property 'requiredString' can not be referenced from a non-isolated context 

Async:

Expression is 'async' but is not marked with 'await'
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant