Files
swift-mirror/test/StringProcessing/Sema/regex_literal_availability.swift
Hamish Knight 30fc57437e [Sema] Diagnose regex literals if Regex<Output> is unavailable
Because we don't form a type-checked call to the
Regex initializer in the AST, we need to explicitly
handle the availability checking for `Regex<Output>`
and the initializer we're implicitly calling.

rdar://92156542
2022-04-22 14:01:15 +01:00

16 lines
455 B
Swift

// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex -target %target-cpu-apple-macosx12.0
// REQUIRES: swift_in_compiler
// REQUIRES: OS=macosx
_ = /x/ // expected-error {{'Regex' is only available in}}
// expected-note@-1 {{add 'if #available' version check}}
_ = #/x/# // expected-error {{'Regex' is only available in}}
// expected-note@-1 {{add 'if #available' version check}}
if #available(SwiftStdlib 5.7, *) {
_ = /x/
_ = #/x/#
}