Repository navigation
feat: map defined types declared inside a function - #214
Merged
Merged
Conversation
A defined type declared inside a function is a local struct derived from eo::defined, with _eo_name as a static member function, the form #210 gave local interfaces. The library already reads both forms of _eo_name, so this adds the rule and a parity case over basic, string, slice, map, function, and struct underlying types. etcd raft's TestConfChangeQuick needs it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WKhFr4YH1YUGTnN1iSi9bQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A defined type declared inside a function, such as
type testFunc func(*Changer, []*pb.ConfChangeSingle) errorin etcd raft'sTestConfChangeQuick, is now a local struct derived fromeo::defined<T, U>. Like a local interface (#210), it writes_eo_nameas a static member function, because C++ allows a local class no static data members.The library already reads both forms of
_eo_namesince #210, so no library change was needed. This PR adds the rule and a parity case.docs/TRANSLATION_RULES.md: a new "Defined types declared inside a function" section. The not-covered list now names only the remaining case, a local defined type over a local struct, which has no_eo_name.tests/parity/local_defined_types: defined types overfloat64,string,[]uint64, a map, a function, and a package-level struct, declared inmain. It checks conversions, operators, comparisons,appendand slicing, map entries, nil function values,%T/%v/%+v/%#v, type assertions, a type switch that tellsIDsfrom[]uint64, and interface equality.Test plan
parity.local_defined_types.{cpp,go}pass, along with the otherdefined_*andlocal_interfacescases._eo_nameforIDsfails the C++ case.🤖 Generated with Claude Code
https://claude.ai/code/session_01WKhFr4YH1YUGTnN1iSi9bQ