From ec78cc95215e1c0bd026bd613346411e8bff699c Mon Sep 17 00:00:00 2001 From: generatedunixname89002005232357 Date: Fri, 23 Feb 2024 08:16:48 -0800 Subject: [PATCH] Revert D54017026: Multisect successfully blamed "D54017026: Combine Ast and Schema structs" for one test failure Summary: This diff reverts D54017026 D54017026: Combine Ast and Schema structs by iahs causes the following test failure: Tests affected: - [cogwheel:cogwheel_windtunnel_e2e_run_slcm#main](https://www.internalfb.com/intern/test/562950069774915/) Here's the Multisect link: https://www.internalfb.com/multisect/4389250 Here are the tasks that are relevant to this breakage: The backout may land if someone accepts it. If this diff has been generated in error, you can Commandeer and Abandon it. Differential Revision: D54112811 fbshipit-source-id: 6e391902aea15bad8fe323d593eead8158b58aa9 --- .../thrift/src/thrift/lib/thrift/ast.thrift | 79 +++++++++++++++++-- .../src/thrift/lib/thrift/schema.thrift | 65 +-------------- 2 files changed, 77 insertions(+), 67 deletions(-) diff --git a/third-party/thrift/src/thrift/lib/thrift/ast.thrift b/third-party/thrift/src/thrift/lib/thrift/ast.thrift index c9db14a748a35..d4b9cc006edff 100644 --- a/third-party/thrift/src/thrift/lib/thrift/ast.thrift +++ b/third-party/thrift/src/thrift/lib/thrift/ast.thrift @@ -15,12 +15,81 @@ */ include "thrift/lib/thrift/schema.thrift" +include "thrift/lib/thrift/standard.thrift" +include "thrift/lib/thrift/protocol.thrift" +include "thrift/lib/thrift/id.thrift" namespace py3 apache.thrift namespace rust thrift_ast -/** This file has been merged into schema.thrift. Please include it and use its types directly. */ -typedef schema.SourceInfo SourceInfo -typedef schema.IdentifierRef IdentifierRef -typedef schema.IncludeRef IncludeRef -typedef schema.Schema Ast +/** + * Information about a thrift source file. + */ +struct SourceInfo { + // A source file name. It can include directory components and/or be a + // virtual file name that doesn't have a correspondent entry in the system's + // directory structure. + // Preserves the legacy behavior of sometimes leaking resolved relative paths. + // The unmodified path is available inside schema.Program. + 1: string fileName; + + /** + * Per-language include statements. + */ + 2: map> languageIncludes; + + /** + * Per-language namespace. + */ + 3: map namespaces; +} + +// An instance of an identifier in a source file. +struct IdentifierRef { + 1: schema.SourceRange range; + 2: standard.TypeUri uri; + // Because enum values don't have URIs, references to them have to point to their owning enum. + // When that happens this field identifies the particular value being referenced. + 3: string enumValue; +} + +// An instance of an include in a source file. +struct IncludeRef { + 1: schema.SourceRange range; + 2: id.ProgramId target; +} + +// A thrift schema that corresponds to one or more thrift files. +@cpp.UseOpEncode +struct Ast { + /** + * The programs included in the schema, accessible by `ProgramId`. + * The first program in the program list must be the main file, + * with (recursively) included programs listed after it. + */ + 1: schema.ProgramList programs; + + /** The values, accessible by `ValueId`. */ + 2: list values; + + /** The definitions, accessible by `DefinitionId`. */ + 4: schema.DefinitionList definitions; + + /** + * DEPRECATED! Get the information from the Program struct. + * Information about the files holding the thrift definitions. + */ + 5: map sources; + + /** + * The source ranges of all references to named entities in the main program. + * The `source_ranges` option must be passed to thrift2ast to populate this map. + */ + 6: list identifierSourceRanges; + + /** + * The source ranges of paths included in the main program. + * The `source_ranges` option must be passed to thrift2ast to populate this map. + */ + 7: list includeSourceRanges; +} diff --git a/third-party/thrift/src/thrift/lib/thrift/schema.thrift b/third-party/thrift/src/thrift/lib/thrift/schema.thrift index 70de4196991c9..a4a5b2e06ec93 100644 --- a/third-party/thrift/src/thrift/lib/thrift/schema.thrift +++ b/third-party/thrift/src/thrift/lib/thrift/schema.thrift @@ -698,71 +698,12 @@ typedef list ProgramList @thrift.Experimental // TODO(afuller): Adapt! @cpp.UseOpEncode struct Schema { - /** - * The programs included in the schema, accessible by `ProgramId`. - * The first program in the program list must be the main file, - * with (recursively) included programs listed after it. - */ + /** The programs included in the schema, accessible by `ProgramId`. */ 1: ProgramList programs; /** The values, accessible by `ValueId`. */ - 2: list values; + 3: list values; /** The definitions, accessible by `DefinitionId`. */ - 3: DefinitionList definitions; - - /** - * DEPRECATED! Get the information from the Program struct. - * Information about the files holding the thrift definitions. - */ - 5: map sources; - - /** - * The source ranges of all references to named entities in the main program. - * The `source_ranges` option must be passed to thrift2ast to populate this map. - */ - 6: list identifierSourceRanges; - - /** - * The source ranges of paths included in the main program. - * The `source_ranges` option must be passed to thrift2ast to populate this map. - */ - 7: list includeSourceRanges; -} - -/** - * Information about a thrift source file. - */ -struct SourceInfo { - // A source file name. It can include directory components and/or be a - // virtual file name that doesn't have a correspondent entry in the system's - // directory structure. - // Preserves the legacy behavior of sometimes leaking resolved relative paths. - // The unmodified path is available inside schema.Program. - 1: string fileName; - - /** - * Per-language include statements. - */ - 2: map> languageIncludes; - - /** - * Per-language namespace. - */ - 3: map namespaces; -} - -// An instance of an identifier in a source file. -struct IdentifierRef { - 1: SourceRange range; - 2: standard.TypeUri uri; - // Because enum values don't have URIs, references to them have to point to their owning enum. - // When that happens this field identifies the particular value being referenced. - 3: string enumValue; -} - -// An instance of an include in a source file. -struct IncludeRef { - 1: SourceRange range; - 2: id.ProgramId target; + 5: DefinitionList definitions; }