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-11458] Property Wrapper with subscript creation crashes if wrapper used in other source file #53859

Closed
swift-ci opened this issue Sep 12, 2019 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software property wrappers Feature: property wrappers

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-11458
Radar rdar://problem/55303660
Original Reporter andyj_at_aspin (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 11 GM, tested on latest releases of both macOS Catalina Beta & macOS Mojave. Test project uses iOS target and iPhone simulator solely as a means of initiating the 'test' functions.

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, PropertyWrappers
Assignee @DougGregor
Priority Medium

md5: 109f02f0d575a03d09e306c4e15d4d63

Issue Description:

The new feature allowing Property Wrappers to define a static subscript that provides the 'enclosing self' to the wrapped property crashes the compiler with a segfault 11 if the wrapper is used in anything other than the file in which is defined.

Taking the definitions and structures defined in the original pull request's unit test file test/Interpreter/property_wrappers.swift which defines the class using the Observable wrapper in the same file, everything is fine. If the definition of the MyTest class is moved into another source file (or another class is defined in another file also using the Observable wrapper) then the compiler segfaults #11 at the subscript function in the wrapper's class.

Original pull request is at #25884

Test project is attached - both set to crash and succeed. This will not compile (see segfault) unless the definition and usage of the MyOtherType class are commented out, leaving the only usage of the Observable wrapper in the file in which it is declared.

@belkadan
Copy link
Contributor

Thanks! The subscript feature isn't officially supported yet (among other things, it hasn't gone through Swift Evolution), but it's good to shake out the bugs.

@swift-ci create

@DougGregor
Copy link
Member

I have a fix for this; PR coming in a bit.

@DougGregor
Copy link
Member

Fixed; test case merged in #27320

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
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. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software property wrappers Feature: property wrappers
Projects
None yet
Development

No branches or pull requests

4 participants