slachiewicz commented on code in PR #3812: URL: https://github.com/apache/thrift/pull/3812#discussion_r4007576759
########## lib/go/test/TypedefIncludeTest.thrift: ########## @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// https://issues.apache.org/jira/browse/THRIFT-6197 + +include "TypedefStructTest.thrift" + +namespace go typedefincludetest + +// A typedef of a struct that lives in another file. THRIFT-3037. +typedef TypedefStructTest.InnerStruct IncludedAlias Review Comment: No reason, and thanks for catching it. That helper is not new to this PR: `generate_typedef` has emitted a `<Name>Ptr` for every typedef since 052abc39c, and nothing in the generator calls it. It exists for users of typedefs of base types, so an optional field can be filled with `TimestampPtr(123)`. The first commit turned a struct typedef into an alias and left that emission in place, which is why `IncludedAlias` got a helper that takes the struct by value, copies it and returns a pointer to the copy. Before the PR a struct typedef got the same helper on top of a pointer type, so it was never usable there either. f0d7d2e28 skips the helper when the typedef is an alias of a struct, so it gets exactly what the struct gets. Typedefs of base types keep theirs (`ForwardTypedefPtr` for the i32 in the same test file). Regenerated `lib/go/test` with the recipe from `Makefile.am`; `go build` of every package in it and `go test ./gopath/src/tests` pass. *This comment was created with AI assistance.* -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
