Files
swift-mirror/test/Parse/parameter_specifier_before_param_name.swift
Michael Gottesman 88729b9e34 [sending] Make {Transferring,Sending}ArgsAndResults a LANGUAGE_FEATURE instead of an UPCOMING_FEATURE.
TLDR: This makes it so that we always can parse sending/transferring but changes
the semantic language effects to be keyed on RegionBasedIsolation instead.

----

The key thing that makes this all work is that I changed all of the "special"
semantic changes originally triggered on *ArgsAndResults to now be triggered
based on RegionBasedIsolation being enabled. This makes a lot of sense since we
want these semantic changes specifically to be combined with the checkers that
RegionBasedIsolation turns on. As a result, even though this causes these two
features to always be enabled, we just parse it but we do not use it for
anything semantically.

rdar://128961672
2024-06-01 23:25:16 -07:00

25 lines
1.4 KiB
Swift

// RUN: %target-typecheck-verify-swift
// REQUIRES: concurrency
@available(SwiftStdlib 5.1, *)
actor MyActor {}
class MyClass {}
// Lifetime specifiers before parameter names were disallowed in Swift 3 (SE-0031).
// `isolated`, `transferring` and `_const` got added after Swift 3 without a diagnostic
// to disallow them before parameter names.
func foo(inout x b: MyClass) {} // expected-error {{'inout' before a parameter name is not allowed, place it before the parameter type instead}}
func foo(borrowing x b: MyClass) {} // expected-error {{'borrowing' before a parameter name is not allowed, place it before the parameter type instead}}
@available(SwiftStdlib 5.1, *)
func foo(isolated x b: MyActor) {} // expected-warning {{'isolated' before a parameter name is not allowed, place it before the parameter type instead; this is an error in the Swift 6 language mode}}
func foo(_const x b: MyClass) {} // expected-warning {{'_const' before a parameter name is not allowed, place it before the parameter type instead; this is an error in the Swift 6 language mode}}
@available(SwiftStdlib 5.1, *)
func foo(transferring x b: MyActor) {} // expected-warning {{'transferring' before a parameter name is not allowed, place it before the parameter type instead}}
// expected-warning @-1 {{'transferring' has been renamed to 'sending' and the 'transferring' spelling will be removed shortly}}