mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Improve some diagnostic with @_implementationOnly violations from internal bridging headers
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: mkdir -p %t/tmp
|
||||
|
||||
// Test with the normal bridging header.
|
||||
// RUN: %target-typecheck-verify-swift -internal-import-bridging-header %S/../Inputs/c-bridging-header.h -sdk %clang-importer-sdk -verify-ignore-unknown
|
||||
|
||||
// RUN: not %target-swift-frontend -typecheck -internal-import-bridging-header %S/../Inputs/c-bridging-header.h -sdk %clang-importer-sdk %s 2>&1 | %FileCheck %s
|
||||
|
||||
// Test with a precompiled bridging header.
|
||||
// RUN: %target-swift-frontend -emit-pch -o %t/c-bridging-header.pch %S/../Inputs/c-bridging-header.h -sdk %clang-importer-sdk
|
||||
// RUN: %target-typecheck-verify-swift -internal-import-bridging-header %t/c-bridging-header.pch -sdk %clang-importer-sdk -verify-ignore-unknown
|
||||
|
||||
|
||||
@inlinable
|
||||
public func f() -> Any {
|
||||
return red
|
||||
// expected-error@-1{{var 'red' is internal and cannot be referenced from an '@inlinable' function}}
|
||||
// expected-warning@-2{{getter for var 'red' is internal and should not be referenced from an '@inlinable' function}}
|
||||
}
|
||||
|
||||
// CHECK: var 'red' imported as 'internal' from bridging header
|
||||
Reference in New Issue
Block a user