mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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
25 lines
1.4 KiB
Swift
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}}
|