Files
swift-mirror/test/StringProcessing/Frontend/disable-flag.swift
Doug Gregor 6bb9cb8b5d [Macros] Always parse macro expansions, diagnose later
Always parse macro expansions, regardless of language mode, and
eliminate the fallback path for very, very, very old object literals
like `#Color`. Instead, check for the feature flag for macro
declaration and at macro expansion time, since this is a semantic
restriction.

While here, refactor things so the vast majority of the macro-handling
logic still applies even if the Swift Swift parser is disabled. Only
attempts to expand the macro will fail. This allows us to enable the
macro-diagnostics test everywhere.
2023-01-02 21:22:04 -08:00

15 lines
703 B
Swift

// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex -disable-experimental-string-processing
// RUN: %target-typecheck-verify-swift -disable-experimental-string-processing -enable-bare-slash-regex
// RUN: %target-typecheck-verify-swift -enable-experimental-string-processing -disable-experimental-string-processing -enable-bare-slash-regex
prefix operator /
_ = /x/
// expected-error@-1 {{'/' is not a prefix unary operator}}
// expected-error@-2 {{cannot find 'x' in scope}}
// expected-error@-3 {{'/' is not a postfix unary operator}}
_ = #/x/# // expected-error {{expected a macro identifier}}
func foo(_ x: Regex<Substring>) {} // expected-error {{cannot find type 'Regex' in scope}}