diff --git a/oi/CodeGen.cpp b/oi/CodeGen.cpp index 9f41c12..9614a1f 100644 --- a/oi/CodeGen.cpp +++ b/oi/CodeGen.cpp @@ -213,9 +213,13 @@ template struct NameProvider {}; )"; + // TODO: stop types being duplicated at this point and remove this check + std::unordered_set emittedTypes; for (const Type& t : typeGraph.finalTypes) { if (dynamic_cast(&t)) continue; + if (!emittedTypes.emplace(t.name()).second) + continue; code += "template <> struct NameProvider<"; code += t.name();