Files
swift-mirror/test/StringProcessing/Sema/regex_builder_unavailable.swift
Hamish Knight 85c41841e5 [test] NFC: Add missing REQUIRES
This test uses regex literals, so needs the
regex parsing code to be available.

rdar://101486764
2022-10-24 17:45:01 +01:00

30 lines
1.3 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex -target %target-cpu-apple-macosx12.0
// REQUIRES: swift_in_compiler
// REQUIRES: OS=macosx
import RegexBuilder
// rdar://97533700 Make sure we can emit an availability diagnostic here.
let _ = Regex { // expected-error {{'Regex' is only available in macOS 13.0 or newer}}
// expected-error@-1 {{'init(_:)' is only available in macOS 13.0 or newer}}
// expected-note@-2 2{{add 'if #available' version check}}
Capture {} // expected-error {{'Capture' is only available in macOS 13.0 or newer}}
// expected-error@-1 {{'init(_:)' is only available in macOS 13.0 or newer}}
// expected-note@-2 2{{add 'if #available' version check}}
}
let _ = Regex { // expected-error {{'Regex' is only available in macOS 13.0 or newer}}
// expected-error@-1 {{'init(_:)' is only available in macOS 13.0 or newer}}
// expected-error@-2 {{'buildPartialBlock(accumulated:next:)' is only available in macOS 13.0 or newer}}
// expected-note@-3 3{{add 'if #available' version check}}
/abc/ // expected-error {{'Regex' is only available in macOS 13.0 or newer}}
// expected-note@-1 {{add 'if #available' version check}}
/def/ // expected-error {{'Regex' is only available in macOS 13.0 or newer}}
// expected-note@-1 {{add 'if #available' version check}}
}