mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Adjust the implementation-only diagnostics to sound more similar
John and I had slightly different styles when adding these; better to keep them in harmony.
This commit is contained in:
@@ -2388,16 +2388,15 @@ NOTE(construct_raw_representable_from_unwrapped_value,none,
|
||||
"construct %0 from unwrapped %1 value", (Type, Type))
|
||||
|
||||
ERROR(decl_from_implementation_only_module,none,
|
||||
"cannot use %0 here; %1 has been imported as "
|
||||
"'@_implementationOnly'",
|
||||
(DeclName, Identifier))
|
||||
"cannot use %0 %1 here; %2 has been imported as implementation-only",
|
||||
(DescriptiveDeclKind, DeclName, Identifier))
|
||||
ERROR(conformance_from_implementation_only_module,none,
|
||||
"cannot use conformance of %0 to %1 here; %2 has been imported as "
|
||||
"'@_implementationOnly'",
|
||||
"implementation-only",
|
||||
(Type, DeclName, Identifier))
|
||||
ERROR(assoc_conformance_from_implementation_only_module,none,
|
||||
"cannot use conformance of %0 to %1 in associated type %3 (inferred as "
|
||||
"%4); %2 has been imported as '@_implementationOnly'",
|
||||
"%4); %2 has been imported as implementation-only",
|
||||
(Type, DeclName, Identifier, Type, Type))
|
||||
|
||||
// Derived conformances
|
||||
@@ -4084,9 +4083,9 @@ WARNING(resilience_decl_unavailable_warn,
|
||||
(DescriptiveDeclKind, DeclName, AccessLevel, unsigned, bool))
|
||||
|
||||
ERROR(inlinable_decl_ref_implementation_only,
|
||||
none, "%0 %1 cannot be used in an inlinable "
|
||||
"function because its module was imported implementation-only",
|
||||
(DescriptiveDeclKind, DeclName))
|
||||
none, "%0 %1 cannot be used in " FRAGILE_FUNC_KIND "2 "
|
||||
"because %3 was imported implementation-only",
|
||||
(DescriptiveDeclKind, DeclName, unsigned, Identifier))
|
||||
|
||||
#undef FRAGILE_FUNC_KIND
|
||||
|
||||
|
||||
@@ -208,7 +208,8 @@ bool TypeChecker::diagnoseInlinableDeclRefAccess(SourceLoc loc,
|
||||
}
|
||||
|
||||
static bool diagnoseDeclExportability(SourceLoc loc, const ValueDecl *D,
|
||||
const SourceFile &userSF) {
|
||||
const SourceFile &userSF,
|
||||
FragileFunctionKind fragileKind) {
|
||||
auto definingModule = D->getModuleContext();
|
||||
if (!userSF.isImportedImplementationOnly(definingModule))
|
||||
return false;
|
||||
@@ -216,7 +217,9 @@ static bool diagnoseDeclExportability(SourceLoc loc, const ValueDecl *D,
|
||||
// TODO: different diagnostics
|
||||
ASTContext &ctx = definingModule->getASTContext();
|
||||
ctx.Diags.diagnose(loc, diag::inlinable_decl_ref_implementation_only,
|
||||
D->getDescriptiveKind(), D->getFullName());
|
||||
D->getDescriptiveKind(), D->getFullName(),
|
||||
static_cast<unsigned>(fragileKind),
|
||||
definingModule->getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -288,9 +291,11 @@ void TypeChecker::diagnoseGenericTypeExportability(const TypeLoc &TL,
|
||||
}));
|
||||
}
|
||||
|
||||
bool TypeChecker::diagnoseDeclRefExportability(SourceLoc loc,
|
||||
bool
|
||||
TypeChecker::diagnoseDeclRefExportability(SourceLoc loc,
|
||||
ConcreteDeclRef declRef,
|
||||
const DeclContext *DC) {
|
||||
const DeclContext *DC,
|
||||
FragileFunctionKind fragileKind) {
|
||||
// We're only interested in diagnosing uses from source files.
|
||||
auto userSF = DC->getParentSourceFile();
|
||||
if (!userSF)
|
||||
@@ -305,7 +310,7 @@ bool TypeChecker::diagnoseDeclRefExportability(SourceLoc loc,
|
||||
return false;
|
||||
|
||||
const ValueDecl *D = declRef.getDecl();
|
||||
if (diagnoseDeclExportability(loc, D, *userSF))
|
||||
if (diagnoseDeclExportability(loc, D, *userSF, fragileKind))
|
||||
return true;
|
||||
if (diagnoseGenericArgumentsExportability(loc, declRef.getSubstitutions(),
|
||||
*userSF)) {
|
||||
|
||||
@@ -1558,6 +1558,7 @@ class ImplementationOnlyImportChecker
|
||||
const TypeRepr *complainRepr) {
|
||||
ModuleDecl *M = offendingType->getModuleContext();
|
||||
auto diag = TC.diagnose(D, diag::decl_from_implementation_only_module,
|
||||
offendingType->getDescriptiveKind(),
|
||||
offendingType->getFullName(), M->getName());
|
||||
highlightOffendingType(TC, diag, complainRepr);
|
||||
}
|
||||
@@ -1830,7 +1831,8 @@ public:
|
||||
return;
|
||||
|
||||
auto diag = TC.diagnose(diagLoc, diag::decl_from_implementation_only_module,
|
||||
PGD->getName(), M->getName());
|
||||
PGD->getDescriptiveKind(), PGD->getName(),
|
||||
M->getName());
|
||||
if (refRange.isValid())
|
||||
diag.highlight(refRange);
|
||||
diag.flush();
|
||||
|
||||
@@ -1891,7 +1891,8 @@ private:
|
||||
/// exposes it in the interface of the current module, diagnose if it cannot
|
||||
/// reasonably be shared.
|
||||
bool diagnoseDeclRefExportability(SourceLoc loc, ConcreteDeclRef declRef,
|
||||
const DeclContext *DC);
|
||||
const DeclContext *DC,
|
||||
FragileFunctionKind fragileKind);
|
||||
|
||||
public:
|
||||
/// Given that a type is used from a particular context which
|
||||
|
||||
@@ -7,93 +7,93 @@
|
||||
import NormalLibrary
|
||||
@_implementationOnly import BADLibrary
|
||||
|
||||
public struct TestConformance: BadProto {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public struct TestConformance: BadProto {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
@usableFromInline struct TestConformanceUFI: BadProto {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline struct TestConformanceUFI: BadProto {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
struct TestConformanceOkay: BadProto {} // ok
|
||||
|
||||
public class TestConformanceClass: BadProto {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public enum TestConformanceEnum: BadProto {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public class TestConformanceClass: BadProto {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public enum TestConformanceEnum: BadProto {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
|
||||
public struct TestGenericParams<T: BadProto> {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public struct TestGenericParams<T: BadProto> {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public struct TestGenericParamsWhereClause<T> where T: BadProto {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public struct TestGenericParamsWhereClause<T> where T: BadProto {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public enum TestCase {
|
||||
case x(BadStruct) // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
case y(Int, BadStruct) // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
case x(BadStruct) // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
case y(Int, BadStruct) // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public func testGenericParams<T: BadProto>(_: T) {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public func testGenericParamsWhereClause<T>(_: T) where T: BadProto {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public func testGenericParams<T: BadProto>(_: T) {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public func testGenericParamsWhereClause<T>(_: T) where T: BadProto {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public func testParams(_: BadStruct, _: BadProto) {}
|
||||
// expected-error@-1 {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
// expected-error@-2 {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public func testResult() -> BadStruct? { return nil } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
// expected-error@-1 {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
// expected-error@-2 {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public func testResult() -> BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public struct TestSubscript {
|
||||
public subscript<T: BadProto>(_: T) -> Int { return 0 } // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public subscript<T>(where _: T) -> Int where T: BadProto { return 0 } // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public subscript(_: BadStruct) -> Int { return 0 } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public subscript(_: Int) -> BadStruct? { return nil } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public subscript<T: BadProto>(_: T) -> Int { return 0 } // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public subscript<T>(where _: T) -> Int where T: BadProto { return 0 } // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public subscript(_: BadStruct) -> Int { return 0 } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public subscript(_: Int) -> BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public struct TestInit {
|
||||
public init(_: BadStruct) {} // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public init<T: BadProto>(_: T) {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public init<T>(where _: T) where T: BadProto {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public init(_: BadStruct) {} // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public init<T: BadProto>(_: T) {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public init<T>(where _: T) where T: BadProto {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public protocol TestInherited: BadProto {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public protocol TestInherited: BadProto {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public protocol TestConstraintBase {
|
||||
associatedtype Assoc
|
||||
}
|
||||
public protocol TestConstraint: TestConstraintBase where Assoc: BadProto {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public protocol TestConstraintEq: TestConstraintBase where Assoc == BadStruct {} // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public protocol TestConstraint: TestConstraintBase where Assoc: BadProto {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public protocol TestConstraintEq: TestConstraintBase where Assoc == BadStruct {} // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public protocol TestAssocType {
|
||||
associatedtype Assoc: BadProto // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
associatedtype Assoc: BadProto // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public protocol TestAssocTypeWhereClause {
|
||||
associatedtype Assoc: Collection where Assoc.Element: BadProto // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
associatedtype Assoc: Collection where Assoc.Element: BadProto // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public enum TestRawType: IntLike { // expected-error {{cannot use 'IntLike' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public enum TestRawType: IntLike { // expected-error {{cannot use struct 'IntLike' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
case x = 1
|
||||
// FIXME: expected-error@-1 {{cannot use conformance of 'IntLike' to 'Equatable' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
// FIXME: expected-error@-1 {{cannot use conformance of 'IntLike' to 'Equatable' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public class TestSubclass: BadClass { // expected-error {{cannot use 'BadClass' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public class TestSubclass: BadClass { // expected-error {{cannot use class 'BadClass' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public typealias TestUnderlying = BadStruct // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public typealias TestGenericParamsAliasWhereClause<T> = T where T: BadProto // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public typealias TestUnderlying = BadStruct // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public typealias TestGenericParamsAliasWhereClause<T> = T where T: BadProto // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public typealias TestGenericParamsAlias<T: BadProto> = T // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public typealias TestGenericParamsAlias<T: BadProto> = T // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public var testBadType: BadStruct? = nil // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var testBadTypeInferred = Optional<BadStruct>.none // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var testBadTypePartiallyInferred: Optional = Optional<BadStruct>.none // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var testBadType: BadStruct? = nil // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var testBadTypeInferred = Optional<BadStruct>.none // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var testBadTypePartiallyInferred: Optional = Optional<BadStruct>.none // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var (testBadTypeTuple1, testBadTypeTuple2): (BadStruct?, BadClass?) = (nil, nil)
|
||||
// expected-error@-1 {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
// expected-error@-2 {{cannot use 'BadClass' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var (testBadTypeTuplePartlyInferred1, testBadTypeTuplePartlyInferred2): (Optional, Optional) = (Optional<Int>.none, Optional<BadStruct>.none) // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var (testBadTypeTuplePartlyInferred3, testBadTypeTuplePartlyInferred4): (Optional, Optional) = (Optional<BadStruct>.none, Optional<Int>.none) // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var testMultipleBindings1: Int? = nil, testMultipleBindings2: BadStruct? = nil // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var testMultipleBindings3: BadStruct? = nil, testMultipleBindings4: Int? = nil // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
// expected-error@-1 {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
// expected-error@-2 {{cannot use class 'BadClass' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var (testBadTypeTuplePartlyInferred1, testBadTypeTuplePartlyInferred2): (Optional, Optional) = (Optional<Int>.none, Optional<BadStruct>.none) // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var (testBadTypeTuplePartlyInferred3, testBadTypeTuplePartlyInferred4): (Optional, Optional) = (Optional<BadStruct>.none, Optional<Int>.none) // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var testMultipleBindings1: Int? = nil, testMultipleBindings2: BadStruct? = nil // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var testMultipleBindings3: BadStruct? = nil, testMultipleBindings4: Int? = nil // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
extension BadStruct { // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension BadStruct { // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public func testExtensionOfBadType() {} // FIXME: Should complain here instead of at the extension decl.
|
||||
}
|
||||
extension BadStruct {
|
||||
func testExtensionOfOkayType() {}
|
||||
}
|
||||
|
||||
extension Array where Element == BadStruct { // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension Array where Element == BadStruct { // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public func testExtensionWithBadRequirement() {} // FIXME: Should complain here instead of at the extension decl.
|
||||
}
|
||||
|
||||
@@ -101,71 +101,71 @@ extension Array where Element == BadStruct {
|
||||
func testExtensionWithOkayRequirement() {} // okay
|
||||
}
|
||||
|
||||
extension Int: BadProto {} // expected-error {{cannot use 'BadProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension Int: BadProto {} // expected-error {{cannot use protocol 'BadProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
struct TestExtensionConformanceOkay {}
|
||||
extension TestExtensionConformanceOkay: BadProto {} // okay
|
||||
|
||||
public protocol TestConstrainedExtensionProto {}
|
||||
extension Array: TestConstrainedExtensionProto where Element == BadStruct { // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension Array: TestConstrainedExtensionProto where Element == BadStruct { // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
|
||||
infix operator !!!!!!: BadPrecedence // expected-error {{cannot use 'BadPrecedence' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
infix operator !!!!!!: BadPrecedence // expected-error {{cannot use precedence group 'BadPrecedence' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
precedencegroup TestLowerThan {
|
||||
lowerThan: BadPrecedence // expected-error {{cannot use 'BadPrecedence' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
lowerThan: BadPrecedence // expected-error {{cannot use precedence group 'BadPrecedence' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
precedencegroup TestHigherThan {
|
||||
higherThan: BadPrecedence // expected-error {{cannot use 'BadPrecedence' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
higherThan: BadPrecedence // expected-error {{cannot use precedence group 'BadPrecedence' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public struct PublicStructStoredProperties {
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@usableFromInline internal struct UFIStructStoredProperties {
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public class PublicClassStoredProperties {
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public typealias NormalProtoAssoc<T: NormalProto> = T.Assoc
|
||||
public func testConformanceInTypealias(_: NormalProtoAssoc<NormalStruct>) {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public func testConformanceInTypealias(_: NormalProtoAssoc<NormalStruct>) {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public struct NormalProtoAssocHolder<T: NormalProto> {
|
||||
public var value: T.Assoc
|
||||
}
|
||||
public func testConformanceInBoundGeneric(_: NormalProtoAssocHolder<NormalStruct>) {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public func testConformanceInBoundGeneric(_: NormalProtoAssocHolder<NormalStruct>) {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public class SubclassOfNormalClass: NormalClass {}
|
||||
|
||||
public func testInheritedConformance(_: NormalProtoAssocHolder<SubclassOfNormalClass>) {} // expected-error {{cannot use conformance of 'NormalClass' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public func testSpecializedConformance(_: NormalProtoAssocHolder<GenericStruct<Int>>) {} // expected-error {{cannot use conformance of 'GenericStruct<T>' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public func testInheritedConformance(_: NormalProtoAssocHolder<SubclassOfNormalClass>) {} // expected-error {{cannot use conformance of 'NormalClass' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public func testSpecializedConformance(_: NormalProtoAssocHolder<GenericStruct<Int>>) {} // expected-error {{cannot use conformance of 'GenericStruct<T>' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
extension Array where Element == NormalProtoAssocHolder<NormalStruct> { // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension Array where Element == NormalProtoAssocHolder<NormalStruct> { // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public func testConstrainedExtensionUsingBadConformance() {}
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public struct ConditionalGenericStruct<T> {}
|
||||
extension ConditionalGenericStruct: NormalProto where T: NormalProto {
|
||||
public typealias Assoc = Int
|
||||
}
|
||||
public func testConditionalGeneric(_: NormalProtoAssocHolder<ConditionalGenericStruct<NormalStruct>>) {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public func testConditionalGeneric(_: NormalProtoAssocHolder<ConditionalGenericStruct<NormalStruct>>) {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public protocol PublicAssociatedTypeProto {
|
||||
associatedtype Assoc: NormalProto
|
||||
@@ -191,15 +191,15 @@ protocol InternalAssociatedTypeProto {
|
||||
public struct PublicInferredAssociatedTypeImpl {
|
||||
public func takesAssoc(_: NormalStruct) {}
|
||||
}
|
||||
extension PublicInferredAssociatedTypeImpl: PublicAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension PublicInferredAssociatedTypeImpl: UFIAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension PublicInferredAssociatedTypeImpl: PublicAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as implementation-only}}
|
||||
extension PublicInferredAssociatedTypeImpl: UFIAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as implementation-only}}
|
||||
extension PublicInferredAssociatedTypeImpl: InternalAssociatedTypeProto {} // okay
|
||||
|
||||
@usableFromInline struct UFIInferredAssociatedTypeImpl {
|
||||
public func takesAssoc(_: NormalStruct) {}
|
||||
}
|
||||
extension UFIInferredAssociatedTypeImpl: PublicAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension UFIInferredAssociatedTypeImpl: UFIAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension UFIInferredAssociatedTypeImpl: PublicAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as implementation-only}}
|
||||
extension UFIInferredAssociatedTypeImpl: UFIAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as implementation-only}}
|
||||
extension UFIInferredAssociatedTypeImpl: InternalAssociatedTypeProto {} // okay
|
||||
|
||||
struct InternalInferredAssociatedTypeImpl {
|
||||
@@ -213,8 +213,8 @@ public struct PublicExplicitAssociatedTypeImpl {
|
||||
public typealias Assoc = NormalStruct
|
||||
public func takesAssoc(_: NormalStruct) {}
|
||||
}
|
||||
extension PublicExplicitAssociatedTypeImpl: PublicAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension PublicExplicitAssociatedTypeImpl: UFIAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension PublicExplicitAssociatedTypeImpl: PublicAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as implementation-only}}
|
||||
extension PublicExplicitAssociatedTypeImpl: UFIAssociatedTypeProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as implementation-only}}
|
||||
extension PublicExplicitAssociatedTypeImpl: InternalAssociatedTypeProto {} // okay
|
||||
|
||||
|
||||
@@ -225,33 +225,33 @@ public protocol BaseProtoWithNoRequirement {
|
||||
public protocol RefinedProto: BaseProtoWithNoRequirement where Assoc: NormalProto {
|
||||
}
|
||||
|
||||
public struct RefinedProtoImpl: RefinedProto { // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public struct RefinedProtoImpl: RefinedProto { // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as implementation-only}}
|
||||
public func takesAssoc(_: NormalStruct) {}
|
||||
}
|
||||
|
||||
public protocol RefinedSelfProto where Self: NormalProto {}
|
||||
extension NormalStruct: RefinedSelfProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension NormalStruct: RefinedSelfProto {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public protocol RefinedSelfProtoInheritance: NormalProto {}
|
||||
extension NormalStruct: RefinedSelfProtoInheritance {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
extension NormalStruct: RefinedSelfProtoInheritance {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
|
||||
public protocol SlightlyMoreComplicatedRequirement {
|
||||
associatedtype Assoc: Collection where Assoc.Element: NormalProto
|
||||
func takesAssoc(_: Assoc)
|
||||
}
|
||||
public struct SlightlyMoreComplicatedRequirementImpl: SlightlyMoreComplicatedRequirement { // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc.Element' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public struct SlightlyMoreComplicatedRequirementImpl: SlightlyMoreComplicatedRequirement { // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc.Element' (inferred as 'NormalStruct'); 'BADLibrary' has been imported as implementation-only}}
|
||||
public func takesAssoc(_: [NormalStruct]) {}
|
||||
}
|
||||
public struct RequirementsHandleSubclassesToo: SlightlyMoreComplicatedRequirement { // expected-error {{cannot use conformance of 'NormalClass' to 'NormalProto' in associated type 'Self.Assoc.Element' (inferred as 'SubclassOfNormalClass'); 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public struct RequirementsHandleSubclassesToo: SlightlyMoreComplicatedRequirement { // expected-error {{cannot use conformance of 'NormalClass' to 'NormalProto' in associated type 'Self.Assoc.Element' (inferred as 'SubclassOfNormalClass'); 'BADLibrary' has been imported as implementation-only}}
|
||||
public func takesAssoc(_: [SubclassOfNormalClass]) {}
|
||||
}
|
||||
|
||||
public struct RequirementsHandleSpecializationsToo: SlightlyMoreComplicatedRequirement { // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc.Element' (inferred as 'ConditionalGenericStruct<NormalStruct>'); 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public struct RequirementsHandleSpecializationsToo: SlightlyMoreComplicatedRequirement { // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' in associated type 'Self.Assoc.Element' (inferred as 'ConditionalGenericStruct<NormalStruct>'); 'BADLibrary' has been imported as implementation-only}}
|
||||
public func takesAssoc(_: [ConditionalGenericStruct<NormalStruct>]) {}
|
||||
}
|
||||
|
||||
public struct ClassConstrainedGenericArg<T: NormalClass>: PublicAssociatedTypeProto { // expected-error {{cannot use conformance of 'NormalClass' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'T'); 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public struct ClassConstrainedGenericArg<T: NormalClass>: PublicAssociatedTypeProto { // expected-error {{cannot use conformance of 'NormalClass' to 'NormalProto' in associated type 'Self.Assoc' (inferred as 'T'); 'BADLibrary' has been imported as implementation-only}}
|
||||
public func takesAssoc(_: T) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ public typealias X = Int
|
||||
|
||||
public typealias NormalProtoAssoc<T: NormalProto> = T.Assoc
|
||||
@inlinable func testConformanceInTypealias() {
|
||||
let x: NormalProtoAssoc<NormalStruct>? = nil // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
let x: NormalProtoAssoc<NormalStruct>? = nil // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
_ = x
|
||||
_ = NormalProtoAssoc<NormalStruct>() // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
_ = NormalProtoAssoc<NormalStruct>() // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
func internalConformanceInTypealias() {
|
||||
@@ -29,11 +29,11 @@ public struct NormalProtoAssocHolder<T: NormalProto> {
|
||||
public init(_ value: T?) {}
|
||||
}
|
||||
@inlinable func testConformanceInBoundGeneric() {
|
||||
let x: NormalProtoAssocHolder<NormalStruct>? = nil // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
let x: NormalProtoAssocHolder<NormalStruct>? = nil // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
_ = x
|
||||
// FIXME: We get this error twice: once for the TypeExpr and once for the implicit init.
|
||||
_ = NormalProtoAssocHolder<NormalStruct>() // expected-error 2 {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
_ = NormalProtoAssocHolder(nil as NormalStruct?) // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
_ = NormalProtoAssocHolder<NormalStruct>() // expected-error 2 {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
_ = NormalProtoAssocHolder(nil as NormalStruct?) // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
func internalConformanceInBoundGeneric() {
|
||||
@@ -44,8 +44,8 @@ func internalConformanceInBoundGeneric() {
|
||||
}
|
||||
|
||||
@inlinable func testDowncast(_ x: Any) -> Bool {
|
||||
let normal = x is NormalProtoAssocHolder<NormalStruct> // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
let alias = x is NormalProtoAssoc<NormalStruct> // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
let normal = x is NormalProtoAssocHolder<NormalStruct> // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
let alias = x is NormalProtoAssoc<NormalStruct> // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
return normal || alias
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ func internalDowncast(_ x: Any) -> Bool {
|
||||
|
||||
@inlinable func testSwitch(_ x: Any) {
|
||||
switch x {
|
||||
case let holder as NormalProtoAssocHolder<NormalStruct>: // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
case let holder as NormalProtoAssocHolder<NormalStruct>: // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
_ = holder
|
||||
break
|
||||
case is NormalProtoAssoc<NormalStruct>: // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
case is NormalProtoAssoc<NormalStruct>: // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
break
|
||||
default:
|
||||
break
|
||||
@@ -85,10 +85,10 @@ public enum NormalProtoEnumUser<T: NormalProto> {
|
||||
|
||||
@inlinable func testEnum() {
|
||||
// FIXME: We get this error twice: once for the pattern and once for the implicit TypeExpr.
|
||||
let x: NormalProtoEnumUser<NormalStruct> = .a // expected-error 2 {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
let x: NormalProtoEnumUser<NormalStruct> = .a // expected-error 2 {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
_ = x
|
||||
// FIXME: We get this error twice: once for the TypeExpr and once for the case.
|
||||
_ = NormalProtoEnumUser<NormalStruct>.a // expected-error 2 {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
_ = NormalProtoEnumUser<NormalStruct>.a // expected-error 2 {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
func internalEnum() {
|
||||
@@ -100,7 +100,7 @@ func internalEnum() {
|
||||
@usableFromInline func testFuncImpl<T: NormalProto>(_: T.Type) {}
|
||||
|
||||
@inlinable func testFunc() {
|
||||
testFuncImpl(NormalStruct.self) // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
testFuncImpl(NormalStruct.self) // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
func internalFunc() {
|
||||
@@ -120,14 +120,14 @@ public struct ForTestingMembers {
|
||||
}
|
||||
|
||||
@inlinable func testMembers() {
|
||||
_ = ForTestingMembers(NormalStruct.self) // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
_ = ForTestingMembers.init(NormalStruct.self) // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
_ = ForTestingMembers(NormalStruct.self) // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
_ = ForTestingMembers.init(NormalStruct.self) // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
_ = ForTestingMembers()[NormalStruct.self] // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
_ = ForTestingMembers()[NormalStruct.self] // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
var instance = ForTestingMembers()
|
||||
instance[NormalStruct.self] = 1 // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
instance[NormalStruct.self] = 1 // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
ForTestingMembers().method(NormalStruct.self) // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
ForTestingMembers().method(NormalStruct.self) // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
extension NormalProtoAssocHolder {
|
||||
@@ -136,35 +136,35 @@ extension NormalProtoAssocHolder {
|
||||
|
||||
@inlinable func testMultipleConformances() {
|
||||
_ = NormalProtoAssocHolder<NormalStruct>.testAnotherConformance(NormalClass.self)
|
||||
// expected-error@-1 2 {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
// expected-error@-2 {{cannot use conformance of 'NormalClass' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
// expected-error@-1 2 {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
// expected-error@-2 {{cannot use conformance of 'NormalClass' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable func localTypeAlias() {
|
||||
typealias LocalUser = NormalProtoAssocHolder<NormalStruct> // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
typealias LocalGenericUser<T> = (T, NormalProtoAssocHolder<NormalStruct>) // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
typealias LocalUser = NormalProtoAssocHolder<NormalStruct> // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
typealias LocalGenericUser<T> = (T, NormalProtoAssocHolder<NormalStruct>) // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
typealias LocalProtoAssoc<T: NormalProto> = T.Assoc
|
||||
_ = LocalProtoAssoc<NormalStruct>() // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
_ = LocalProtoAssoc<NormalStruct>() // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable func localFunctions() {
|
||||
func local(_: NormalProtoAssocHolder<NormalStruct>) {} // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
func localReturn() -> NormalProtoAssocHolder<NormalStruct> { fatalError() } // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
let _ = { (_: NormalProtoAssocHolder<NormalStruct>) in return } // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
let _ = { () -> NormalProtoAssocHolder<NormalStruct> in fatalError() } // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
func local(_: NormalProtoAssocHolder<NormalStruct>) {} // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
func localReturn() -> NormalProtoAssocHolder<NormalStruct> { fatalError() } // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
let _ = { (_: NormalProtoAssocHolder<NormalStruct>) in return } // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
let _ = { () -> NormalProtoAssocHolder<NormalStruct> in fatalError() } // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable public func signatureOfInlinable(_: NormalProtoAssocHolder<NormalStruct>) {} // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@inlinable public func signatureOfInlinable(_: NormalProtoAssocHolder<NormalStruct>) {} // expected-error{{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
public func testDefaultArgument(_: Int = NormalProtoAssoc<NormalStruct>()) {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public func testDefaultArgument(_: Int = NormalProtoAssoc<NormalStruct>()) {} // expected-error {{cannot use conformance of 'NormalStruct' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
|
||||
public class SubclassOfNormalClass: NormalClass {}
|
||||
|
||||
@inlinable public func testInheritedConformance() {
|
||||
_ = NormalProtoAssocHolder<SubclassOfNormalClass>.self // expected-error {{cannot use conformance of 'NormalClass' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
_ = NormalProtoAssocHolder<SubclassOfNormalClass>.self // expected-error {{cannot use conformance of 'NormalClass' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
@inlinable public func testSpecializedConformance() {
|
||||
_ = NormalProtoAssocHolder<GenericStruct<Int>>.self // expected-error {{cannot use conformance of 'GenericStruct<T>' to 'NormalProto' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
_ = NormalProtoAssocHolder<GenericStruct<Int>>.self // expected-error {{cannot use conformance of 'GenericStruct<T>' to 'NormalProto' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@@ -10,34 +10,34 @@
|
||||
|
||||
@inlinable
|
||||
public func testStructFromIndirect() {
|
||||
_ = StructFromIndirect() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = StructFromIndirect() // expected-error {{struct 'StructFromIndirect' cannot be used in an '@inlinable' function because 'indirects' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func testAliasFromIndirect() {
|
||||
_ = AliasFromIndirect() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = AliasFromIndirect() // expected-error {{type alias 'AliasFromIndirect' cannot be used in an '@inlinable' function because 'indirects' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func testGenericAliasFromIndirect() {
|
||||
_ = GenericAliasFromIndirect<Int>() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = GenericAliasFromIndirect<Int>() // expected-error {{type alias 'GenericAliasFromIndirect' cannot be used in an '@inlinable' function because 'indirects' was imported implementation-only}}
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
||||
@inlinable
|
||||
public func testFunctionFromIndirect() {
|
||||
globalFunctionFromIndirect() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
globalFunctionFromIndirect() // expected-error {{global function 'globalFunctionFromIndirect()' cannot be used in an '@inlinable' function because 'indirects' was imported implementation-only}}
|
||||
}
|
||||
|
||||
// Variables
|
||||
|
||||
@inlinable
|
||||
public func testVariableFromIndirect_get() {
|
||||
_ = globalVariableFromIndirect // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = globalVariableFromIndirect // expected-error {{var 'globalVariableFromIndirect' cannot be used in an '@inlinable' function because 'indirects' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func testVariableFromIndirect_set() {
|
||||
globalVariableFromIndirect = 5 // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
globalVariableFromIndirect = 5 // expected-error {{var 'globalVariableFromIndirect' cannot be used in an '@inlinable' function because 'indirects' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
@inlinable
|
||||
public func testStructFromDirect() {
|
||||
_ = StructFromDirect() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = StructFromDirect() // expected-error {{struct 'StructFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -21,7 +21,7 @@ public func testStructFromIndirect() {
|
||||
|
||||
@inlinable
|
||||
public func testAliasFromDirect() {
|
||||
_ = AliasFromDirect() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = AliasFromDirect() // expected-error {{type alias 'AliasFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -31,7 +31,7 @@ public func testAliasFromIndirect() {
|
||||
|
||||
@inlinable
|
||||
public func testGenericAliasFromDirect() {
|
||||
_ = GenericAliasFromDirect<Int>() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = GenericAliasFromDirect<Int>() // expected-error {{type alias 'GenericAliasFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -44,7 +44,7 @@ public func testGenericAliasFromIndirect() {
|
||||
|
||||
@inlinable
|
||||
public func testFunctionFromDirect() {
|
||||
globalFunctionFromDirect() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
globalFunctionFromDirect() // expected-error {{global function 'globalFunctionFromDirect()' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -56,7 +56,7 @@ public func testFunctionFromIndirect() {
|
||||
|
||||
@inlinable
|
||||
public func testVariableFromDirect_get() {
|
||||
_ = globalVariableFromDirect // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = globalVariableFromDirect // expected-error {{var 'globalVariableFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -66,7 +66,7 @@ public func testVariableFromIndirect_get() {
|
||||
|
||||
@inlinable
|
||||
public func testVariableFromDirect_set() {
|
||||
globalVariableFromDirect = 5 // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
globalVariableFromDirect = 5 // expected-error {{var 'globalVariableFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -78,27 +78,27 @@ public func testVariableFromIndirect_set() {
|
||||
|
||||
@inlinable
|
||||
public func testExtensionMethod(s: inout StructFromIndirect) {
|
||||
s.extensionMethodFromDirect() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
s.extensionMethodFromDirect() // expected-error {{instance method 'extensionMethodFromDirect()' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func testExtensionProperty_get(s: inout StructFromIndirect) {
|
||||
_ = s.extensionPropertyFromDirect // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = s.extensionPropertyFromDirect // expected-error {{property 'extensionPropertyFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func testExtensionProperty_set(s: inout StructFromIndirect) {
|
||||
s.extensionPropertyFromDirect = 5 // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
s.extensionPropertyFromDirect = 5 // expected-error {{property 'extensionPropertyFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func testExtensionSubscript_get(s: inout StructFromIndirect) {
|
||||
// FIXME: why is this error being double-emitted?
|
||||
_ = s[extensionSubscript: 0] // expected-error 2 {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = s[extensionSubscript: 0] // expected-error 2 {{cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func testExtensionSubscript_set(s: inout StructFromIndirect) {
|
||||
// FIXME: why is this error being double-emitted?
|
||||
s[extensionSubscript: 0] = 5 // expected-error 2 {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
s[extensionSubscript: 0] = 5 // expected-error 2 {{cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import indirects
|
||||
|
||||
@inlinable
|
||||
public func testStructFromDirect() {
|
||||
_ = StructFromDirect() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = StructFromDirect() // expected-error {{struct 'StructFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -21,7 +21,7 @@ public func testStructFromIndirect() {
|
||||
|
||||
@inlinable
|
||||
public func testAliasFromDirect() {
|
||||
_ = AliasFromDirect() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = AliasFromDirect() // expected-error {{type alias 'AliasFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -31,7 +31,7 @@ public func testAliasFromIndirect() {
|
||||
|
||||
@inlinable
|
||||
public func testGenericAliasFromDirect() {
|
||||
_ = GenericAliasFromDirect<Int>() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = GenericAliasFromDirect<Int>() // expected-error {{type alias 'GenericAliasFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -44,7 +44,7 @@ public func testGenericAliasFromIndirect() {
|
||||
|
||||
@inlinable
|
||||
public func testFunctionFromDirect() {
|
||||
globalFunctionFromDirect() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
globalFunctionFromDirect() // expected-error {{global function 'globalFunctionFromDirect()' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -56,7 +56,7 @@ public func testFunctionFromIndirect() {
|
||||
|
||||
@inlinable
|
||||
public func testVariableFromDirect_get() {
|
||||
_ = globalVariableFromDirect // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = globalVariableFromDirect // expected-error {{var 'globalVariableFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -66,7 +66,7 @@ public func testVariableFromIndirect_get() {
|
||||
|
||||
@inlinable
|
||||
public func testVariableFromDirect_set() {
|
||||
globalVariableFromDirect = 5 // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
globalVariableFromDirect = 5 // expected-error {{var 'globalVariableFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@@ -78,27 +78,27 @@ public func testVariableFromIndirect_set() {
|
||||
|
||||
@inlinable
|
||||
public func testExtensionMethod(s: inout StructFromIndirect) {
|
||||
s.extensionMethodFromDirect() // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
s.extensionMethodFromDirect() // expected-error {{instance method 'extensionMethodFromDirect()' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func testExtensionProperty_get(s: inout StructFromIndirect) {
|
||||
_ = s.extensionPropertyFromDirect // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = s.extensionPropertyFromDirect // expected-error {{property 'extensionPropertyFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func testExtensionProperty_set(s: inout StructFromIndirect) {
|
||||
s.extensionPropertyFromDirect = 5 // expected-error {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
s.extensionPropertyFromDirect = 5 // expected-error {{property 'extensionPropertyFromDirect' cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func testExtensionSubscript_get(s: inout StructFromIndirect) {
|
||||
// FIXME: why is this error being double-emitted?
|
||||
_ = s[extensionSubscript: 0] // expected-error 2 {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
_ = s[extensionSubscript: 0] // expected-error 2 {{cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func testExtensionSubscript_set(s: inout StructFromIndirect) {
|
||||
// FIXME: why is this error being double-emitted?
|
||||
s[extensionSubscript: 0] = 5 // expected-error 2 {{cannot be used in an inlinable function because its module was imported implementation-only}}
|
||||
s[extensionSubscript: 0] = 5 // expected-error 2 {{cannot be used in an '@inlinable' function because 'directs' was imported implementation-only}}
|
||||
}
|
||||
|
||||
@@ -7,72 +7,72 @@
|
||||
@_implementationOnly import BADLibrary
|
||||
|
||||
public struct PublicStructStoredProperties {
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // okay
|
||||
private var privatelyBad: BadStruct? // okay
|
||||
private let letIsLikeVar = [BadStruct]() // okay
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@usableFromInline internal struct UFIStructStoredProperties {
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // okay
|
||||
private var privatelyBad: BadStruct? // okay
|
||||
private let letIsLikeVar = [BadStruct]() // okay
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public class PublicClassStoredProperties {
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // okay
|
||||
private var privatelyBad: BadStruct? // okay
|
||||
private let letIsLikeVar = [BadStruct]() // okay
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
// MARK: Frozen types
|
||||
|
||||
@_fixed_layout
|
||||
public struct FrozenPublicStructStoredProperties {
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private let letIsLikeVar: [BadStruct] = [] // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar: [BadStruct] = [] // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@_fixed_layout
|
||||
@usableFromInline internal struct FrozenUFIStructStoredProperties {
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private let letIsLikeVar: [BadStruct] = [] // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar: [BadStruct] = [] // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@_fixed_layout
|
||||
public class FrozenPublicClassStoredProperties {
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
private let letIsLikeVar: [BadStruct] = [] // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar: [BadStruct] = [] // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use 'BadStruct' here; 'BADLibrary' has been imported as '@_implementationOnly'}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user