XCTActivity.name nullability change breaks existing XCTest code

Originator:marcelofabri.mf
Number:rdar://33506542 Date Originated:25-jul-2017 08:38 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 9 beta 4
Classification:UI/Usability Reproducible:Always
 
Summary:
XCTestCase now implements XCTActivity. 
XCTestCase has a name property inherited from XCTest which is optional. 
XCTestCase has a name property which was changed from option to non-optional in the latest seed (https://developer.apple.com/documentation/xctest/xctactivity/2887219-name?changes=latest_beta).
This breaks existing code.

Steps to Reproduce:
1. Add this snippet to a unit test target in Xcode 9 b4:

extension XCTestCase {
    var sanitizedName: String? {
        guard let fullName = self.name else {
            return nil
        }
        return fullName
}

2. Build the unit tests

Expected Results:
This would compile.

Actual Results:
This doesn’t compile in the latest seed. XCTActivity.name should be reverted to String? or XCTest.name should be non-optional.

Version:
Xcode 9 beta 4

Notes:
One can use #if (swift >= 3.2) to workaround this.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!