swift-book
swift-book copied to clipboard
Expression patterns can appear outside of switch case labels
Location
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/patterns#Expression-Pattern
Description
Expression patterns appear only in switch statement case labels.
This is not true. Expression patterns may appear in both switch case items and case conditions. For example, if case 0 = i {} or while case .function(let name, numParams: 0) = node {}.
rdar://46341816