mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Warn on resilient uses of @_implementationOnly as deprecated
Report uses of `@_implementationOnly` in resilient modules as deprecated. With a fixit to replace it with `internal` or delete it when imports are internal by default. Uses of `@_implementationOnly` in non-resilient modules is already reported as being unsafe.
This commit is contained in:
23
test/Sema/implementation-only-deprecated.swift
Normal file
23
test/Sema/implementation-only-deprecated.swift
Normal file
@@ -0,0 +1,23 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: split-file %s %t --leading-lines
|
||||
|
||||
// RUN: %target-swift-frontend -emit-module %t/Lib.swift \
|
||||
// RUN: -enable-library-evolution -swift-version 5 \
|
||||
// RUN: -emit-module-path %t/Lib.swiftmodule
|
||||
// RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t \
|
||||
// RUN: -enable-library-evolution -swift-version 5 \
|
||||
// RUN: -verify -verify-additional-prefix swift-5-
|
||||
// RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t \
|
||||
// RUN: -enable-library-evolution -swift-version 5 \
|
||||
// RUN: -enable-upcoming-feature InternalImportsByDefault \
|
||||
// RUN: -verify -verify-additional-prefix default-to-internal-
|
||||
|
||||
//--- Lib.swift
|
||||
public struct SomeType {}
|
||||
|
||||
//--- Client.swift
|
||||
@_implementationOnly import Lib
|
||||
// expected-swift-5-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' and family instead}} {{1-21=internal}}
|
||||
// expected-default-to-internal-warning @-2 {{'@_implementationOnly' is deprecated, use a bare import as 'InternalImportsByDefault' is enabled}} {{1-22=}}
|
||||
|
||||
internal func foo(_: SomeType) {}
|
||||
Reference in New Issue
Block a user