Skip to content

[SR-11458] Property Wrapper with subscript creation crashes if wrapper used in other source file #53859

@swift-ci

Description

@swift-ci
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.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareproperty wrappersFeature: property wrappers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions