mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Custom diagnostic for var decls referencing a restricted type
Replace the `here` part of the generic exportability diagnostic for variables with: `in a property declaration marked public or in a '@frozen' or '@usableFromInline' context`. The full diagnostic now looks like: ``` error: cannot use struct 'ImportedType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenDependency' has been imported as implementation-only ``` This should be improved further to support implicitly exported memory layouts in non-library-evolution and embedded.
This commit is contained in:
@@ -3831,7 +3831,8 @@ ERROR(decl_from_hidden_module,none,
|
||||
"in an extension with public or '@usableFromInline' members|"
|
||||
"in an extension with conditional conformances|"
|
||||
"in a public or '@usableFromInline' conformance|"
|
||||
"in an '@available' attribute here}1; "
|
||||
"in an '@available' attribute here|"
|
||||
"in a property declaration marked public or in a '@frozen' or '@usableFromInline' context}1; "
|
||||
"%select{%2 has been imported as implementation-only|"
|
||||
"it is an SPI imported from %2|"
|
||||
"it is SPI|"
|
||||
@@ -3848,7 +3849,8 @@ ERROR(typealias_desugars_to_type_from_hidden_module,none,
|
||||
"in an extension with public or '@usableFromInline' members|"
|
||||
"in an extension with conditional conformance|"
|
||||
"in a public or '@usableFromInline' conformance|"
|
||||
"<<ERROR>>}3 "
|
||||
"<<ERROR>>|"
|
||||
"in a property declaration marked public or in a '@frozen' or '@usableFromInline' context}3 "
|
||||
"because %select{%4 has been imported as implementation-only|"
|
||||
"it is an SPI imported from %4|"
|
||||
"<<ERROR>>|"
|
||||
@@ -3863,7 +3865,8 @@ ERROR(conformance_from_implementation_only_module,none,
|
||||
"as result builder here|"
|
||||
"in an extension with public or '@usableFromInline' members|"
|
||||
"in an extension with conditional conformances|"
|
||||
"<<ERROR>>|<<ERROR>>}2; "
|
||||
"<<ERROR>>|<<ERROR>>|"
|
||||
"in a property declaration marked public or in a '@frozen' or '@usableFromInline' context}2; "
|
||||
"%select{%3 has been imported as implementation-only|"
|
||||
"the conformance is declared as SPI in %3|"
|
||||
"the conformance is declared as SPI|"
|
||||
|
||||
@@ -263,6 +263,7 @@ static bool shouldDiagnoseDeclAccess(const ValueDecl *D,
|
||||
case ExportabilityReason::General:
|
||||
case ExportabilityReason::ResultBuilder:
|
||||
case ExportabilityReason::PropertyWrapper:
|
||||
case ExportabilityReason::PublicVarDecl:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2376,7 +2376,8 @@ public:
|
||||
if (seenVars.count(theVar))
|
||||
return;
|
||||
|
||||
checkType(theVar->getValueInterfaceType(), /*typeRepr*/nullptr, theVar);
|
||||
checkType(theVar->getValueInterfaceType(), /*typeRepr*/nullptr, theVar,
|
||||
ExportabilityReason::PublicVarDecl);
|
||||
|
||||
for (auto attr : theVar->getAttachedPropertyWrappers()) {
|
||||
checkType(attr->getType(), attr->getTypeRepr(), theVar,
|
||||
@@ -2398,7 +2399,8 @@ public:
|
||||
});
|
||||
|
||||
checkType(TP->hasType() ? TP->getType() : Type(),
|
||||
TP->getTypeRepr(), anyVar ? (Decl *)anyVar : (Decl *)PBD);
|
||||
TP->getTypeRepr(), anyVar ? (Decl *)anyVar : (Decl *)PBD,
|
||||
ExportabilityReason::PublicVarDecl);
|
||||
|
||||
// Check the property wrapper types.
|
||||
if (anyVar) {
|
||||
|
||||
@@ -69,7 +69,8 @@ enum class DeclAvailabilityFlag : uint8_t {
|
||||
using DeclAvailabilityFlags = OptionSet<DeclAvailabilityFlag>;
|
||||
|
||||
// This enum must be kept in sync with
|
||||
// diag::decl_from_hidden_module and
|
||||
// diag::decl_from_hidden_module,
|
||||
// diag::typealias_desugars_to_type_from_hidden_module, and
|
||||
// diag::conformance_from_implementation_only_module.
|
||||
enum class ExportabilityReason : unsigned {
|
||||
General,
|
||||
@@ -79,6 +80,7 @@ enum class ExportabilityReason : unsigned {
|
||||
ExtensionWithConditionalConformances,
|
||||
Inheritance,
|
||||
AvailableAttribute,
|
||||
PublicVarDecl,
|
||||
};
|
||||
|
||||
/// A description of the restrictions on what declarations can be referenced
|
||||
|
||||
@@ -18,6 +18,6 @@ public class Bar {
|
||||
|
||||
@available(macOS 10.10, iOS 8.0, *)
|
||||
public class Baz {
|
||||
public var macos: MacOSSPIProto? // expected-error {{cannot use protocol 'MacOSSPIProto' here; it is SPI}}
|
||||
public var macos: MacOSSPIProto? // expected-error {{cannot use protocol 'MacOSSPIProto' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
public var ios: iOSSPIProto?
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ import Foo
|
||||
|
||||
@available(macOS 10.10, iOS 8.0, *)
|
||||
public struct Foo {
|
||||
public var macos: MacOSSPIClass // expected-error {{cannot use class 'MacOSSPIClass' here; it is an SPI imported from 'Foo'}}
|
||||
public var macos: MacOSSPIClass // expected-error {{cannot use class 'MacOSSPIClass' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is an SPI imported from 'Foo'}}
|
||||
public var ios: iOSSPIClass
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import SPIContainer
|
||||
@_spi(a) public let a: SPIInterface1 = .init()
|
||||
@_spi(a) public let b: SPIInterface2 = .init()
|
||||
|
||||
public let c: SPIInterface1 = .init() // expected-error{{cannot use class 'SPIInterface1' here; it is an SPI imported from 'SPIContainer'}}
|
||||
public let d: SPIInterface2 = .init() // expected-error{{cannot use class 'SPIInterface2' here; it is an SPI imported from 'SPIContainer'}}
|
||||
public let c: SPIInterface1 = .init() // expected-error{{cannot use class 'SPIInterface1' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is an SPI imported from 'SPIContainer'}}
|
||||
public let d: SPIInterface2 = .init() // expected-error{{cannot use class 'SPIInterface2' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is an SPI imported from 'SPIContainer'}}
|
||||
|
||||
@inlinable
|
||||
public func inlinableUsingSPI() {
|
||||
@@ -21,7 +21,7 @@ public func inlinableUsingSPI() {
|
||||
public let e: SPIInterface2 = .init()
|
||||
|
||||
@available(iOS, unavailable)
|
||||
public let f: SPIInterface2 = .init() // expected-error{{cannot use class 'SPIInterface2' here; it is an SPI imported from 'SPIContainer'}}
|
||||
public let f: SPIInterface2 = .init() // expected-error{{cannot use class 'SPIInterface2' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is an SPI imported from 'SPIContainer'}}
|
||||
|
||||
@inlinable
|
||||
@available(macOS, unavailable)
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
@_spi(a) public let a: SPIInterface1
|
||||
@_spi(a) public let b: SPIInterface2
|
||||
|
||||
public let c: SPIInterface1 // expected-error{{cannot use class 'SPIInterface1' here; it is an SPI imported from '__ObjC'}}
|
||||
public let d: SPIInterface2 // expected-error{{cannot use class 'SPIInterface2' here; it is an SPI imported from '__ObjC'}}
|
||||
public let c: SPIInterface1 // expected-error{{cannot use class 'SPIInterface1' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is an SPI imported from '__ObjC'}}
|
||||
public let d: SPIInterface2 // expected-error{{cannot use class 'SPIInterface2' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is an SPI imported from '__ObjC'}}
|
||||
|
||||
@inlinable
|
||||
public func inlinableUsingSPI() { // expected-warning{{public declarations should have an availability attribute with an introduction version}}
|
||||
|
||||
@@ -5,4 +5,4 @@ import SPIContainerImporter
|
||||
|
||||
@_spi(a) public let a: SPIInterface1
|
||||
|
||||
public let c: SPIInterface1 // expected-error{{cannot use class 'SPIInterface1' here; it is an SPI imported from 'SPIContainer'}}
|
||||
public let c: SPIInterface1 // expected-error{{cannot use class 'SPIInterface1' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is an SPI imported from 'SPIContainer'}}
|
||||
|
||||
@@ -34,8 +34,8 @@ public protocol IOIProtocol {}
|
||||
|
||||
public struct PublicStruct : IOIProtocol, SPIProtocol { // expected-error {{cannot use protocol 'IOIProtocol' in a public or '@usableFromInline' conformance; 'Lib' has been imported as implementation-only}}
|
||||
// expected-error @-1 {{cannot use protocol 'SPIProtocol' in a public or '@usableFromInline' conformance; 'Lib' has been imported as implementation-only}}
|
||||
public var spiStruct = SPIStruct() // expected-error {{cannot use struct 'SPIStruct' here; 'Lib' has been imported as implementation-only}}
|
||||
public var ioiStruct = IOIStruct() // expected-error {{cannot use struct 'IOIStruct' here; 'Lib' has been imported as implementation-only}}
|
||||
public var spiStruct = SPIStruct() // expected-error {{cannot use struct 'SPIStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'Lib' has been imported as implementation-only}}
|
||||
public var ioiStruct = IOIStruct() // expected-error {{cannot use struct 'IOIStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'Lib' has been imported as implementation-only}}
|
||||
|
||||
@inlinable
|
||||
public func publicInlinable() {
|
||||
|
||||
@@ -51,10 +51,10 @@ func inlinable() -> SPIClass { // expected-error {{class 'SPIClass' cannot be us
|
||||
// expected-error@-1 {{stored property 'spiInFrozen' cannot be declared '@_spi' in a '@frozen' struct}}
|
||||
|
||||
var spiTypeInFrozen = SPIStruct() // expected-error {{struct 'SPIStruct' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
// expected-error@-1 {{cannot use struct 'SPIStruct' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use struct 'SPIStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
// expected-error@-2 {{initializer 'init()' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
|
||||
private var spiTypeInFrozen1: SPIClass // expected-error {{cannot use class 'SPIClass' here; it is SPI}}
|
||||
private var spiTypeInFrozen1: SPIClass // expected-error {{cannot use class 'SPIClass' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
}
|
||||
|
||||
@_spi(S)
|
||||
@@ -81,8 +81,8 @@ public func genFuncBad<T: SPIProtocol>(_ t: T) {} // expected-error {{cannot use
|
||||
@_spi(S) func internalCantBeSPI() {} // expected-error{{internal global function cannot be declared '@_spi' because only public and open declarations can be '@_spi'}} {{1-10=}}
|
||||
|
||||
public struct PublicStructWithProperties {
|
||||
public var a: SPIClass // expected-error {{cannot use class 'SPIClass' here; it is SPI}}
|
||||
public var b = SPIClass() // expected-error {{cannot use class 'SPIClass' here; it is SPI}}
|
||||
public var a: SPIClass // expected-error {{cannot use class 'SPIClass' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
public var b = SPIClass() // expected-error {{cannot use class 'SPIClass' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
}
|
||||
|
||||
@_spi(S)
|
||||
|
||||
@@ -149,7 +149,7 @@ public func implementationDetailsUser() {
|
||||
|
||||
public struct ClientStruct {
|
||||
#if !SKIP_ERRORS
|
||||
public var a: SPIOnlyStruct // expected-error {{cannot use struct 'SPIOnlyStruct' here; 'SPIOnlyImportedLib' was imported for SPI only}}
|
||||
public var a: SPIOnlyStruct // expected-error {{cannot use struct 'SPIOnlyStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'SPIOnlyImportedLib' was imported for SPI only}}
|
||||
// expected-error@+1 {{cannot use property 'wrappedValue' here; 'SPIOnlyImportedLib' was imported for SPI only}}
|
||||
@SPIOnlyPropertyWrapper(42) public var aWrapped: Any // expected-error {{cannot use generic struct 'SPIOnlyPropertyWrapper' as property wrapper here; 'SPIOnlyImportedLib' was imported for SPI only}}
|
||||
#endif
|
||||
|
||||
@@ -79,7 +79,7 @@ public struct ResilientStructSPIMembers {
|
||||
@_spi(Foo) public var computedProperty: SPIType { SPIType() }
|
||||
|
||||
@_spi(Foo) public var storedProperty1: SPIType
|
||||
// expected-error@-1 {{cannot use class 'SPIType' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
// expected-error@-2 {{stored property 'storedProperty1' cannot be declared '@_spi' in a '@frozen' struct}}
|
||||
|
||||
@_spi(Foo) public var storedProperty2 = SPIType()
|
||||
@@ -89,7 +89,7 @@ public struct ResilientStructSPIMembers {
|
||||
// expected-error@-1 {{stored property 'lazyProperty1' cannot be declared '@_spi' in a '@frozen' struct}}
|
||||
|
||||
@_spi(Foo) public lazy var lazyProperty2: SPIType = SPIType()
|
||||
// expected-error@-1 {{cannot use class 'SPIType' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
// expected-error@-2 {{stored property 'lazyProperty2' cannot be declared '@_spi' in a '@frozen' struct}}
|
||||
|
||||
@_spi(Foo) @Wrapper public var wrappedProperty1: SPIType
|
||||
@@ -108,24 +108,24 @@ public struct ResilientStructSPIMembers {
|
||||
public func method(_: SPIType) {} // expected-error {{cannot use class 'SPIType' here; it is SPI}}
|
||||
|
||||
public var storedProperty1: SPIType
|
||||
// expected-error@-1 {{cannot use class 'SPIType' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
|
||||
public var storedProperty2 = SPIType()
|
||||
// expected-error@-1 {{cannot use class 'SPIType' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
// expected-error@-2 {{class 'SPIType' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
// expected-error@-3 {{initializer 'init()' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
|
||||
public var computedProperty: SPIType { SPIType() } // expected-error {{cannot use class 'SPIType' here; it is SPI}}
|
||||
public var computedProperty: SPIType { SPIType() } // expected-error {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
|
||||
public lazy var lazyProperty1 = SPIType() // expected-error {{cannot use class 'SPIType' here; it is SPI}}
|
||||
public lazy var lazyProperty1 = SPIType() // expected-error {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
|
||||
public lazy var lazyProperty2: SPIType = SPIType() // expected-error {{cannot use class 'SPIType' here; it is SPI}}
|
||||
public lazy var lazyProperty2: SPIType = SPIType() // expected-error {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
|
||||
@Wrapper public var wrappedProperty1: SPIType
|
||||
// expected-error@-1 {{cannot use class 'SPIType' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
|
||||
@Wrapper public var wrappedProperty2 = SPIType()
|
||||
// expected-error@-1 {{cannot use class 'SPIType' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
// expected-error@-2 {{class 'SPIType' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
// expected-error@-3 {{initializer 'init()' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
|
||||
@@ -140,24 +140,24 @@ public struct ResilientStructSPIMembers {
|
||||
private func method(_: SPIType) {}
|
||||
|
||||
private var storedProperty1: SPIType
|
||||
// expected-error@-1 {{cannot use class 'SPIType' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
|
||||
private var storedProperty2 = SPIType()
|
||||
// expected-error@-1 {{cannot use class 'SPIType' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
// expected-error@-2 {{class 'SPIType' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
// expected-error@-3 {{initializer 'init()' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
|
||||
private var computedProperty: SPIType { SPIType() }
|
||||
|
||||
private lazy var lazyProperty1 = SPIType() // expected-error {{cannot use class 'SPIType' here; it is SPI}}
|
||||
private lazy var lazyProperty1 = SPIType() // expected-error {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
|
||||
private lazy var lazyProperty2: SPIType = SPIType() // expected-error {{cannot use class 'SPIType' here; it is SPI}}
|
||||
private lazy var lazyProperty2: SPIType = SPIType() // expected-error {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
|
||||
@Wrapper private var wrappedProperty1: SPIType
|
||||
// expected-error@-1 {{cannot use class 'SPIType' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
|
||||
@Wrapper private var wrappedProperty2 = SPIType()
|
||||
// expected-error@-1 {{cannot use class 'SPIType' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use class 'SPIType' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
// expected-error@-2 {{class 'SPIType' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
// expected-error@-3 {{initializer 'init()' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ public func legalAccessToIndirect(arg: StructFromIndirect = StructFromIndirect()
|
||||
|
||||
public struct ExposedLayoutPublic {
|
||||
public var publicField: StructFromDirect // expected-error {{property cannot be declared public because its type uses an internal type}}
|
||||
// expected-error @-1 {{cannot use struct 'StructFromDirect' here; 'directs' has been imported as implementation-only}}
|
||||
// expected-error @-1 {{cannot use struct 'StructFromDirect' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'directs' has been imported as implementation-only}}
|
||||
// expected-note @-2 {{struct 'StructFromDirect' is imported by this file as 'internal' from 'directs'}}
|
||||
|
||||
private var privateField: StructFromDirect
|
||||
|
||||
@@ -200,7 +200,7 @@ public func legalAccessToIndirect(arg: StructFromIndirect = StructFromIndirect()
|
||||
}
|
||||
|
||||
public struct ExposedLayoutPublic {
|
||||
public var publicField: StructFromDirect // expected-error {{cannot use struct 'StructFromDirect' here; 'directs' has been imported as implementation-only}}
|
||||
public var publicField: StructFromDirect // expected-error {{cannot use struct 'StructFromDirect' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'directs' has been imported as implementation-only}}
|
||||
|
||||
private var privateField: StructFromDirect // FIXME should error
|
||||
}
|
||||
|
||||
@@ -87,16 +87,16 @@ public typealias TestGenericParamsAliasWhereClause<T> = T where T: BadProto // e
|
||||
|
||||
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 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 testBadType: BadStruct? = nil // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var testBadTypeInferred = Optional<BadStruct>.none // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var testBadTypePartiallyInferred: Optional = Optional<BadStruct>.none // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var (testBadTypeTuple1, testBadTypeTuple2): (BadStruct?, BadClass?) = (nil, nil)
|
||||
// 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}}
|
||||
// expected-error@-1 {{cannot use class 'BadClass' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
// expected-error@-2 {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; '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' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; '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' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var testMultipleBindings1: Int? = nil, testMultipleBindings2: BadStruct? = nil // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var testMultipleBindings3: BadStruct? = nil, testMultipleBindings4: Int? = nil // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
|
||||
extension BadStruct { // expected-error {{cannot use struct 'BadStruct' in an extension with public or '@usableFromInline' members; 'BADLibrary' has been imported as implementation-only}}
|
||||
public func testExtensionOfBadType() {}
|
||||
@@ -140,39 +140,39 @@ precedencegroup TestHigherThan {
|
||||
}
|
||||
|
||||
@frozen public struct PublicStructStoredProperties {
|
||||
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}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
// expected-error@-1 {{struct 'BadStruct' cannot be used in a property initializer in a '@frozen' type because 'BADLibrary' was imported 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 struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@frozen @usableFromInline internal struct UFIStructStoredProperties {
|
||||
@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}}
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
// expected-error@-1 {{struct 'BadStruct' cannot be used in a property initializer in a '@frozen' type because 'BADLibrary' was imported 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 struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@_fixed_layout public class PublicClassStoredProperties {
|
||||
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}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
// expected-error@-1 {{struct 'BadStruct' cannot be used in a property initializer in a '@frozen' type because 'BADLibrary' was imported 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 struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public typealias NormalProtoAssoc<T: NormalProto> = T.Assoc
|
||||
|
||||
@@ -8,98 +8,98 @@
|
||||
// expected-warning @-1 {{'@_implementationOnly' is deprecated, use 'internal import' instead}}
|
||||
|
||||
public struct PublicStructStoredProperties {
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; '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 struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@usableFromInline internal struct UFIStructStoredProperties {
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; '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 struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
public class PublicClassStoredProperties {
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; '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 struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
// MARK: Frozen types
|
||||
|
||||
@frozen
|
||||
public struct FrozenPublicStructStoredProperties {
|
||||
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}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar: [BadStruct] = [] // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; '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 struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@frozen
|
||||
@usableFromInline internal struct FrozenUFIStructStoredProperties {
|
||||
@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}}
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar: [BadStruct] = [] // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; '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 struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@_fixed_layout
|
||||
// expected-warning@-1 {{'@frozen' attribute is now used for fixed-layout structs}}
|
||||
public struct FixedLayoutPublicStructStoredProperties {
|
||||
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}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar: [BadStruct] = [] // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; '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 struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@_fixed_layout
|
||||
// expected-warning@-1 {{'@frozen' attribute is now used for fixed-layout structs}}
|
||||
@usableFromInline internal struct FixedLayoutUFIStructStoredProperties {
|
||||
@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}}
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar: [BadStruct] = [] // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; '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 struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@_fixed_layout
|
||||
public class FrozenPublicClassStoredProperties {
|
||||
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}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
private let letIsLikeVar: [BadStruct] = [] // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; '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 struct 'BadStruct' here; 'BADLibrary' has been imported as implementation-only}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'BADLibrary' has been imported as implementation-only}}
|
||||
}
|
||||
|
||||
@@ -118,16 +118,16 @@ public typealias TestGenericParamsAliasWhereClause<T> = T where T: BadProto // e
|
||||
|
||||
public typealias TestGenericParamsAlias<T: BadProto> = T // expected-error {{cannot use protocol 'BadProto' here; it is SPI}}
|
||||
|
||||
public var testBadType: BadStruct? = nil // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
public var testBadTypeInferred = Optional<BadStruct>.none // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
public var testBadTypePartiallyInferred: Optional = Optional<BadStruct>.none // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
public var testBadType: BadStruct? = nil // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
public var testBadTypeInferred = Optional<BadStruct>.none // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
public var testBadTypePartiallyInferred: Optional = Optional<BadStruct>.none // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
public var (testBadTypeTuple1, testBadTypeTuple2): (BadStruct?, BadClass?) = (nil, nil)
|
||||
// expected-error@-1 {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
// expected-error@-2 {{cannot use class 'BadClass' here; it is SPI}}
|
||||
public var (testBadTypeTuplePartlyInferred1, testBadTypeTuplePartlyInferred2): (Optional, Optional) = (Optional<Int>.none, Optional<BadStruct>.none) // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
public var (testBadTypeTuplePartlyInferred3, testBadTypeTuplePartlyInferred4): (Optional, Optional) = (Optional<BadStruct>.none, Optional<Int>.none) // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
public var testMultipleBindings1: Int? = nil, testMultipleBindings2: BadStruct? = nil // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
public var testMultipleBindings3: BadStruct? = nil, testMultipleBindings4: Int? = nil // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
// expected-error@-1 {{cannot use class 'BadClass' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
// expected-error@-2 {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
public var (testBadTypeTuplePartlyInferred1, testBadTypeTuplePartlyInferred2): (Optional, Optional) = (Optional<Int>.none, Optional<BadStruct>.none) // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
public var (testBadTypeTuplePartlyInferred3, testBadTypeTuplePartlyInferred4): (Optional, Optional) = (Optional<BadStruct>.none, Optional<Int>.none) // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
public var testMultipleBindings1: Int? = nil, testMultipleBindings2: BadStruct? = nil // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
public var testMultipleBindings3: BadStruct? = nil, testMultipleBindings4: Int? = nil // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
|
||||
extension BadStruct {
|
||||
public func testExtensionOfBadType() {}
|
||||
@@ -171,39 +171,39 @@ extension Array: TestConstrainedExtensionProto where Element == BadStruct { // e
|
||||
//}
|
||||
|
||||
@frozen public struct PublicStructStoredProperties {
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
// expected-error@-1 {{struct 'BadStruct' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
}
|
||||
|
||||
@frozen @usableFromInline internal struct UFIStructStoredProperties {
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
@usableFromInline var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
// expected-error@-1 {{struct 'BadStruct' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
}
|
||||
|
||||
@_fixed_layout public class PublicClassStoredProperties {
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
public var publiclyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
internal var internallyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
private var privatelyBad: BadStruct? // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
private let letIsLikeVar = [BadStruct]() // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
// expected-error@-1 {{struct 'BadStruct' cannot be used in a property initializer in a '@frozen' type because it is SPI}}
|
||||
|
||||
private var computedIsOkay: BadStruct? { return nil } // okay
|
||||
private static var staticIsOkay: BadStruct? // okay
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' here; it is SPI}}
|
||||
@usableFromInline internal var computedUFIIsNot: BadStruct? { return nil } // expected-error {{cannot use struct 'BadStruct' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
|
||||
}
|
||||
|
||||
public typealias NormalProtoAssoc<T: NormalProto> = T.Assoc
|
||||
|
||||
@@ -228,8 +228,8 @@ extension NonPublicExtendedType {
|
||||
}
|
||||
|
||||
public struct Struct { // expected-remark {{implicitly used struct 'Int' is imported via 'Swift'}}
|
||||
public var propWithInferredIntType = 42
|
||||
public var propWithExplicitType: String = "Text" // expected-remark {{struct 'String' is imported via 'Swift'}}
|
||||
public var propWithInferredIntType = 42 // expected-remark {{struct 'Int' is imported via 'Swift'}}
|
||||
public var propWithExplicitType: String = "Text" // expected-remark 3 {{struct 'String' is imported via 'Swift'}}
|
||||
}
|
||||
|
||||
public func publicFunction() {
|
||||
@@ -246,7 +246,7 @@ package func packageFunc(a: PackageType = packageFunc()) {} // expected-remark {
|
||||
public func spiFunc(a: ToUseFromSPI) {} // expected-remark {{struct 'ToUseFromSPI' is imported via 'SPIOnlyUsedInSPI'}}
|
||||
|
||||
public protocol Countable {
|
||||
var count: Int { get } // expected-remark {{struct 'Int' is imported via 'Swift'}}
|
||||
var count: Int { get } // expected-remark 3 {{struct 'Int' is imported via 'Swift'}}
|
||||
}
|
||||
|
||||
extension Extended: Countable { // expected-remark {{struct 'Extended' is imported via 'RetroactiveConformance'}}
|
||||
|
||||
Reference in New Issue
Block a user