Skip to content

Commit b52a4e1

Browse files
committed
Swift: make unknown entity type check more solid
1 parent fd63bab commit b52a4e1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

swift/extractor/infra/SwiftDispatcher.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ class SwiftDispatcher {
8080
void emitUnknown(E* entity) {
8181
auto label = assignNewLabel(entity);
8282
using Trap = BindingTrapOf<E>;
83-
static_assert(sizeof(Trap) == sizeof(label),
84-
"Binding traps of unknown entities must only have the `id` field (the class "
85-
"should be empty in schema.yml)");
86-
emit(Trap{label});
83+
Trap entry{label};
84+
// check that Trap only has the `id` field by using structured binding on it
85+
auto [id] = entry;
86+
std::ignore = id;
87+
emit(entry);
8788
emit(ElementIsUnknownTrap{label});
8889
}
8990

0 commit comments

Comments
 (0)