disallow circular struct references (#8851)

* detect and fail for circular struct dependencies

* pr comments

* pr comment
This commit is contained in:
Justin Davis
2026-02-04 10:15:05 -05:00
committed by GitHub
parent 4623cfa4bc
commit ea0a73d168
4 changed files with 60 additions and 1 deletions

View File

@@ -927,6 +927,9 @@ std::unique_ptr<Parser> FlatCompiler::GenerateCode(const FlatCOptions& options,
auto err = parser->ConformTo(conform_parser);
if (!err.empty()) Error("schemas don\'t conform: " + err, false);
}
if (parser->HasCircularStructDependency()) {
Error("schema has circular struct dependencies: " + filename, false);
}
if (options.schema_binary || opts.binary_schema_gen_embed) {
parser->Serialize();
}