Skip to content

Commit b52781e

Browse files
committed
Sema: Generalize the diagnostic about types with @_implementationOnly
1 parent dd55d0d commit b52781e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3848,7 +3848,7 @@ ERROR(decl_from_hidden_module,none,
38483848
"C++ types from imported module %2 do not support library evolution|"
38493849
"it was imported via the internal bridging header|"
38503850
"%2 was not imported publicly|"
3851-
"it is a struct marked '@_implementationOnly'}3",
3851+
"%0 is marked '@_implementationOnly'}3",
38523852
(const Decl *, unsigned, Identifier, unsigned))
38533853
ERROR(typealias_desugars_to_type_from_hidden_module,none,
38543854
"%0 aliases '%1.%2' and cannot be used %select{here|"
@@ -3867,7 +3867,7 @@ ERROR(typealias_desugars_to_type_from_hidden_module,none,
38673867
"C++ types from imported module %4 do not support library evolution|"
38683868
"it was imported via the internal bridging header|"
38693869
"%4 was not imported publicly|"
3870-
"it is a struct marked '@_implementationOnly'}5",
3870+
"%0 is marked '@_implementationOnly'}5",
38713871
(const TypeAliasDecl *, StringRef, StringRef, unsigned, Identifier, unsigned))
38723872
ERROR(conformance_from_implementation_only_module,none,
38733873
"cannot use conformance of %0 to %1 %select{here|as property wrapper here|"
@@ -3884,7 +3884,7 @@ ERROR(conformance_from_implementation_only_module,none,
38843884
"C++ types from imported module %3 do not support library evolution|"
38853885
"it was imported via the internal bridging header|"
38863886
"%3 was not imported publicly|"
3887-
"it is a struct marked '@_implementationOnly'}4",
3887+
"%0 is marked '@_implementationOnly'}4",
38883888
(Type, Identifier, unsigned, Identifier, unsigned))
38893889
NOTE(assoc_conformance_from_implementation_only_module,none,
38903890
"in associated type %0 (inferred as %1)", (Type, Type))
@@ -7353,7 +7353,7 @@ ERROR(inlinable_decl_ref_from_hidden_module,
73537353
"C++ APIs from imported module %2 do not support library evolution|"
73547354
"it was imported via the internal bridging header|"
73557355
"%2 was not imported publicly|"
7356-
"it is a struct marked '@_implementationOnly'}3",
7356+
"%0 is marked '@_implementationOnly'}3",
73577357
(const ValueDecl *, unsigned, Identifier, unsigned))
73587358

73597359
ERROR(inlinable_typealias_desugars_to_type_from_hidden_module,
@@ -7366,7 +7366,7 @@ ERROR(inlinable_typealias_desugars_to_type_from_hidden_module,
73667366
"C++ types from imported module %4 do not support library evolution|"
73677367
"it was imported via the internal bridging header|"
73687368
"%4 was not imported publicly|"
7369-
"it is a struct marked '@_implementationOnly'}5",
7369+
"%0 is marked '@_implementationOnly'}5",
73707370
(const TypeAliasDecl *, StringRef, StringRef, unsigned, Identifier, unsigned))
73717371

73727372
NOTE(missing_import_inserted,

test/Sema/hidden-memory-layout.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public func implicitlyInlinablePublic() {
120120
let _: ExposedLayoutPublic = ExposedLayoutPublic()
121121
let _: ExposedLayoutPrivate = ExposedLayoutPrivate()
122122
let _: HiddenLayout = HiddenLayout()
123-
// expected-embedded-opt-in-error @-1 2 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because it is a struct marked '@_implementationOnly'}}
123+
// expected-embedded-opt-in-error @-1 2 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because 'HiddenLayout' is marked '@_implementationOnly'}}
124124

125125
let _: ExposedEnumPublic = ExposedEnumPublic.A
126126
let _: ExposedEnumPrivate = ExposedEnumPrivate.A
@@ -130,7 +130,7 @@ private func implicitlyInlinablePrivate() {
130130
let _: ExposedLayoutPublic = ExposedLayoutPublic()
131131
let _: ExposedLayoutPrivate = ExposedLayoutPrivate()
132132
let _: HiddenLayout = HiddenLayout()
133-
// expected-embedded-opt-in-error @-1 2 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because it is a struct marked '@_implementationOnly'}}
133+
// expected-embedded-opt-in-error @-1 2 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because 'HiddenLayout' is marked '@_implementationOnly'}}
134134

135135
let _: ExposedEnumPublic = ExposedEnumPublic.A
136136
let _: ExposedEnumPrivate = ExposedEnumPrivate.A
@@ -169,10 +169,10 @@ public struct ExposedLayoutPublicUser {
169169
private var b: ExposedLayoutPrivate
170170

171171
private var c: HiddenLayout
172-
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is a struct marked '@_implementationOnly'}}
172+
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenLayout' is marked '@_implementationOnly'}}
173173

174174
private func privateFunc(h: HiddenLayout) {}
175-
// expected-embedded-opt-in-error @-1 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because it is a struct marked '@_implementationOnly'}}
175+
// expected-embedded-opt-in-error @-1 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because 'HiddenLayout' is marked '@_implementationOnly'}}
176176
}
177177

178178
internal struct ExposedLayoutInternalUser {
@@ -184,10 +184,10 @@ internal struct ExposedLayoutInternalUser {
184184
private var aa: ExposedLayoutInternal
185185
private var b: ExposedLayoutPrivate
186186
private var c: HiddenLayout
187-
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is a struct marked '@_implementationOnly'}}
187+
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenLayout' is marked '@_implementationOnly'}}
188188

189189
private func privateFunc(h: HiddenLayout) {}
190-
// expected-embedded-opt-in-error @-1 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because it is a struct marked '@_implementationOnly'}}
190+
// expected-embedded-opt-in-error @-1 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because 'HiddenLayout' is marked '@_implementationOnly'}}
191191
}
192192

193193
private struct ExposedLayoutPrivateUser {
@@ -199,10 +199,10 @@ private struct ExposedLayoutPrivateUser {
199199
private var aa: ExposedLayoutInternal
200200
private var b: ExposedLayoutPrivate
201201
private var c: HiddenLayout
202-
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is a struct marked '@_implementationOnly'}}
202+
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenLayout' is marked '@_implementationOnly'}}
203203

204204
private func privateFunc(h: HiddenLayout) {}
205-
// expected-embedded-opt-in-error @-1 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because it is a struct marked '@_implementationOnly'}}
205+
// expected-embedded-opt-in-error @-1 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because 'HiddenLayout' is marked '@_implementationOnly'}}
206206
}
207207

208208
#if UseImplementationOnly

0 commit comments

Comments
 (0)