[SR-11458] Property Wrapper with subscript creation crashes if wrapper used in other source file #53859
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
crash
Bug: A crash, i.e., an abnormal termination of software
property wrappers
Feature: property wrappers
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
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.
The text was updated successfully, but these errors were encountered: