Conversation
There was a problem hiding this comment.
Pull request overview
Adds initial Go generics (type parameters) support to the Go parser, including new tag kind/fields and a corresponding unit test fixture.
Changes:
- Introduce a
tparamkind andtparamsfield for Gofunctags. - Parse and attach type-parameter lists for generic functions/methods.
- Add a generics-focused unit test and update docs/news and field listing expectations.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| parsers/go.c | Adds parsing and tagging for Go generic type parameters and exposes them via a new field/kind. |
| docs/news/HEAD.rst | Documents the new Go receiver/tparams tagging support. |
| Units/parser-go.r/go-generics.d/input.go | New test input covering a generic function with type constraints. |
| Units/parser-go.r/go-generics.d/expected.tags | Expected tags updated to assert tparam and tparams output. |
| Units/parser-go.r/go-generics.d/args.ctags | Test args enabling the new Go kind/field. |
| Tmain/list-fields.d/stdout-expected.txt | Updates field-list output to include tparams. |
| Tmain/list-fields-with-prefix.d/stdout-expected.txt | Updates prefixed field-list output to include tparams. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4397 +/- ##
=========================================
Coverage ? 86.07%
=========================================
Files ? 254
Lines ? 63905
Branches ? 0
=========================================
Hits ? 55005
Misses ? 8900
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {true, 'P', "packageName", "name for specifying imported package"}, | ||
| {true, 'a', "talias", "type aliases"}, | ||
| {false,'R', "receiver", "receivers"}, | ||
| {false,'Z', "tparam", "type parameters", .version = 1, }, |
There was a problem hiding this comment.
The initializer for the new tparam kind includes an extra trailing comma before the closing brace (.version = 1, }). While accepted by many compilers, it can trigger warnings under stricter compilation settings; consider removing it to match the style of neighboring initializers.
| {false,'Z', "tparam", "type parameters", .version = 1, }, | |
| {false,'Z', "tparam", "type parameters", .version = 1 }, |
There was a problem hiding this comment.
I like this style because this style makes a patch I will create in the future smaller.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7ec1e29 to
4fc6a2a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a86ddc3 to
8f43cce
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 30 changed files in this pull request and generated 21 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 30 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
parsers/go.c:1411
- In
parseConstTypeVar,kindis mutated toGOTAG_TALIASwhen=is encountered. Becausekindis then reused for subsequentTypeSpecs in the sametype (...)declaration, any later non-alias type specs can be mis-parsed/tagged astalias(and may skip the type-body parsing path guarded bykind == GOTAG_TYPE). Use a per-spec variable (e.g.,specKind) instead of modifying the function parameter.
if (isType (token, TOKEN_EQUAL))
{
kind = GOTAG_TALIAS;
readToken (token);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 30 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 30 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a74df58 to
4ee8b08
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 30 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| static bool isArraySpec (intArray *corks, vString *tparams_str) | ||
| { | ||
| const char *cstr = vStringValue (tparams_str); | ||
| size_t cstr_len = vStringLength (tparams_str); | ||
|
|
||
| if (intArrayCount (corks) == 0) | ||
| return true; | ||
|
|
||
| if (intArrayCount (corks) > 1 || | ||
| (cstr_len > 2 | ||
| && cstr | ||
| && cstr [cstr_len - 1] == ']' | ||
| && cstr [cstr_len - 2] == ',')) | ||
| return false; | ||
|
|
||
| for (unsigned int i = 0; i < intArrayCount (corks); i++) | ||
| { | ||
| int cork = intArrayItem (corks, i); | ||
| tagEntryInfo *e = getEntryInCorkQueue (cork); | ||
| if (!e) | ||
| return false; /* Maybe "_" in the array. */ | ||
|
|
||
| if (e->extensionFields.typeRef [0]) | ||
| return false; /* a constraint is given */ | ||
| } | ||
|
|
||
| return true; | ||
| } |
| if (isArraySpec (tparams_indexes, tparams->str)) | ||
| { | ||
| markCorkEntryAsPlaceholderInBatch (tparams_indexes); | ||
| intArrayDelete (tparams_indexes); | ||
| tparams_indexes = NULL; | ||
| } |
| const ( | ||
| UUIDBuflen = 256 | ||
| ) | ||
| type UUID [UUIDBuflen]byte |
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
No description provided.