Skip to content

[SR-7949] Crash when bridging NSError to CLError #3678

Open
@sharplet

Description

@sharplet
Previous ID SR-7949
Radar rdar://problem/40878715
Original Reporter @sharplet
Type Bug
Environment

Xcode 10 beta 1

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

md5: d3a7d254efdede1a220eb1527c0e9772

Issue Description:

Under Xcode 9 / Swift 4.1, it was possible to construct an NSError with the appropriate domain and code and have it bridge to a CLError using an as? cast in Swift. This causes a crash in Xcode 10 / Swift 4.2.

To reproduce, run the attached playground in Xcode 10. It contains this code:

import CoreLocation

let error = NSError(
  domain: kCLErrorDomain,
  code: CLError.geocodeFoundNoResult.rawValue)

error.localizedDescription
error is CLError
error as? CLError

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions