Skip to content

Commit 75bae79

Browse files
echistyakovfacebook-github-bot
authored andcommitted
Remove support for NewType typedef annotation
Summary: I have no idea why I even implemented this in the first place. I can't think of any applications where this might be useful. The feature is completely unused. The feature was not supported in the legacy generator (type aliases were used always): https://www.internalfb.com/code/fbsource/[bbea5a1ec838]/fbcode/thrift/compiler/generate/t_go_generator.cc?lines=971 So I think we can safely kill it. Reviewed By: leoleovich Differential Revision: D52568785 fbshipit-source-id: 929d6f36f70e1f9608484ce9983a6f03cb44aef6
1 parent be281ed commit 75bae79

File tree

25 files changed

+4
-3077
lines changed

25 files changed

+4
-3077
lines changed

third-party/thrift/src/thrift/annotation/go.thrift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,3 @@ struct Name {
3838
struct Tag {
3939
1: string tag;
4040
}
41-
42-
// Annotation for declaring a typedef as a new type (rather than an alias).
43-
//
44-
// type T1 = T2 // alias declaration
45-
// type T1 T2 // type definition
46-
@scope.Typedef
47-
struct NewType {}

third-party/thrift/src/thrift/compiler/generate/t_mstch_go_generator.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,6 @@ class mstch_go_typedef : public mstch_typedef {
684684
this,
685685
{
686686
{"typedef:go_name", &mstch_go_typedef::go_name},
687-
{"typedef:go_newtype?", &mstch_go_typedef::go_newtype},
688687
{"typedef:go_qualified_name", &mstch_go_typedef::go_qualified_name},
689688
{"typedef:go_qualified_new_func",
690689
&mstch_go_typedef::go_qualified_new_func},
@@ -697,10 +696,6 @@ class mstch_go_typedef : public mstch_typedef {
697696
});
698697
}
699698
mstch::node go_name() { return go_name_(); }
700-
mstch::node go_newtype() {
701-
return typedef_->find_structured_annotation_or_null(kGoNewTypeUri) !=
702-
nullptr;
703-
}
704699
mstch::node go_qualified_name() {
705700
auto prefix = data_.go_package_alias_prefix(typedef_->program());
706701
auto name = go_name_();

third-party/thrift/src/thrift/compiler/generate/templates/go/types/typedef.mustache

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
This template generates a thrift typedef
2020
2121
}}
22-
type {{typedef:go_name}} {{!
23-
}}{{^typedef:go_newtype?}}= {{/typedef:go_newtype?}}{{!
24-
}}{{#typedef:type}}{{> common/type}}{{/typedef:type}}
22+
type {{typedef:go_name}} = {{#typedef:type}}{{> common/type}}{{/typedef:type}}
2523

2624
{{! new function }}
2725
{{> types/typedef_method_new}}

third-party/thrift/src/thrift/compiler/lib/uri.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ inline constexpr auto kHackModuleInternalUri =
159159
// go
160160
inline constexpr auto kGoNameUri = "facebook.com/thrift/annotation/go/Name";
161161
inline constexpr auto kGoTagUri = "facebook.com/thrift/annotation/go/Tag";
162-
inline constexpr auto kGoNewTypeUri =
163-
"facebook.com/thrift/annotation/go/NewType";
164162

165163
inline constexpr auto kGeneratePatchUri =
166164
"facebook.com/thrift/op/GeneratePatch";

third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/gen-android/com/facebook/thrift/annotation/go_deprecated/NewType.java

Lines changed: 0 additions & 116 deletions
This file was deleted.

third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/gen-go_mstch/thrift/annotation/go/metadata.go

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/gen-go_mstch/thrift/annotation/go/types.go

Lines changed: 0 additions & 94 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/gen-hack/go_types.php

Lines changed: 0 additions & 86 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)