mirror of
https://github.com/apple/swift.git
synced 2026-03-04 18:24:35 +01:00
This PR introduces implicit bridging from annotated smart pointers to reference counted objects to Swift foreign reference types. The bridging only happens when these smart pointers are passed around by value. The frontend only sees the Swift foreign reference types in the signature and the actual bridging happens during SILGen when we look at the original clang types and note that they differ significantly from the native types. The bridging of parameters did not quite fit into the existing structure of bridging conversions as smart pointers are non-trivial types passed around as addresses and existing bridging conversions were implemented for types passed directly. rdar://156521316
13 lines
1.5 KiB
Swift
13 lines
1.5 KiB
Swift
// RUN: %target-typecheck-verify-swift -cxx-interoperability-mode=default -disable-availability-checking -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %S%{fs-sep}Inputs -verify-additional-file %S%{fs-sep}Inputs%{fs-sep}refcounted-smartptrs.h
|
|
import RefCountedSmartPtrs
|
|
|
|
func triggerWarnings(_ a: errors.MissingToRawPtr, // @expected-error {{'MissingToRawPtr' is not a member type of enum '__ObjC.errors'}}
|
|
_ b: errors.MissingConversionFunction, // @expected-error {{'MissingConversionFunction' is not a member type of enum '__ObjC.errors'}}
|
|
_ c: errors.MultipleConversionFunctions, // @expected-error {{'MultipleConversionFunctions' is not a member type of enum '__ObjC.errors'}}
|
|
_ d: errors.WrongConversionSignature, // @expected-error {{'WrongConversionSignature' is not a member type of enum '__ObjC.errors'}}
|
|
_ e: errors.PrivateConversionFunction, // @expected-error {{'PrivateConversionFunction' is not a member type of enum '__ObjC.errors'}}
|
|
_ f: errors.NoSuitableCtor, // @expected-error {{'NoSuitableCtor' is not a member type of enum '__ObjC.errors'}}
|
|
_ g: errors.AmbiguousCtors, // @expected-error {{'AmbiguousCtors' is not a member type of enum '__ObjC.errors'}}
|
|
_ h: errors.MismatchingPointerTypes) { // @expected-error {{'MismatchingPointerTypes' is not a member type of enum '__ObjC.errors'}}
|
|
}
|