forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregex_builder_unavailable.swift
29 lines (21 loc) · 1.3 KB
/
regex_builder_unavailable.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 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}}
}