Files
swift-mirror/test/Sema/accessibility_multi_module.swift
Jordan Rose fef3a3768c Use access scopes instead of adjustAccessLevelForProtocolExtension
This gets adjustAccessLevelForProtocolExtension, a hack of sorts to
begin with, out of ValueDecl's general API, and down to a helper for
isAccessibleFrom and isSetterAccessibleFrom. (The only reason these
two don't go through access scopes is as an optimization.)
2018-07-23 16:36:16 -07:00

28 lines
1.3 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module -primary-file %S/Inputs/accessibility_multi_other_module.swift -emit-module-path %t/accessibility_multi_other_module.swiftmodule
// RUN: %target-swift-frontend -typecheck -I %t -primary-file %s -verify -verify-ignore-unknown
import accessibility_multi_other_module
func testPrivateConformance(_ instance: PrivateConformance) {
instance.publicExtensionMember()
// expected-error@-1 {{'publicExtensionMember' is inaccessible due to 'private' protection level}}
instance.internalExtensionMember()
// expected-error@-1 {{'internalExtensionMember' is inaccessible due to 'private' protection level}}
instance.publicFPExtensionMember()
// expected-error@-1 {{'publicFPExtensionMember' is inaccessible due to 'fileprivate' protection level}}
instance.internalFPExtensionMember()
// expected-error@-1 {{'internalFPExtensionMember' is inaccessible due to 'fileprivate' protection level}}
}
func testInternalConformance(_ instance: InternalConformance) {
instance.publicExtensionMember()
// expected-error@-1 {{'publicExtensionMember' is inaccessible due to 'internal' protection level}}
instance.internalExtensionMember()
// expected-error@-1 {{'internalExtensionMember' is inaccessible due to 'internal' protection level}}
}