Skip to content

Commit efbc938

Browse files
committed
Sema: Allow nested structs in embedded code
1 parent 495035d commit efbc938

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2946,7 +2946,8 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
29462946

29472947
// We don't allow nested types inside inlinable contexts.
29482948
auto kind = DC->getFragileFunctionKind();
2949-
if (kind.kind != FragileFunctionKind::None) {
2949+
if (kind.kind != FragileFunctionKind::None &&
2950+
kind.kind != FragileFunctionKind::EmbeddedAlwaysEmitIntoClient) {
29502951
NTD->diagnose(diag::local_type_in_inlinable_function, NTD->getName(),
29512952
kind.getSelector());
29522953
}

test/Sema/implementation-only-import-embedded.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ internal func explicitNonInliableInternal(arg: StructFromDirect = StructFromDire
148148
implicitlyInlinablePublic()
149149
implicitlyInlinablePrivate()
150150
explicitNonInliable()
151+
152+
struct NestedStruct {}
151153
}
152154

153155
struct Accessors {

0 commit comments

Comments
 (0)