Skip to content

cl: conf.TypeAbbrSuffix - #883

Merged
xushiwei merged 1 commit into
goplus:mainfrom
xushiwei:q
Sep 30, 2026
Merged

xushiwei merged 1 commit into
goplus:mainfrom
xushiwei:q

Conversation

@xushiwei

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.51%. Comparing base (39cc473) to head (6479608).
⚠️ Report is 26 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #883      +/-   ##
==========================================
+ Coverage   88.49%   88.51%   +0.01%     
==========================================
  Files          22       22              
  Lines        1860     1863       +3     
==========================================
+ Hits         1646     1649       +3     
  Misses        214      214              
Flag Coverage Δ
llgo-tests 88.51% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: add TypeAbbrSuffix config field

Clean, well-scoped change. The new TypeAbbrSuffix field is wired consistently through all layers (tool/config.go → tool/gen.go → cl/compile.go → cl/ctx.go), reuses the existing rmSuffix helper, and the logic at cl/ctx.go:344-351 correctly strips the suffix only when the type is not present in TypeAbbr. The golden test config exercises the new path (Remapping TypeAbbr entry replaced with TypeAbbrSuffix: ["ping"]).

Performance & security: No issues. rmSuffix is a pure, allocation-free string slice guarded by HasSuffix, runs only during code generation, and introduces no new trust-boundary surface (it mirrors the existing TypePrefix/TypeSuffix pattern).

Minor / non-blocking

  • Field ordering is inconsistent across definitions. tool/config.go places TypeAbbrSuffix before TypeAbbr; cl/compile.go places it after; in cl/ctx.go typeAbbrSuffix sits in its own block far from typeAbbr. Since the two are semantically coupled, keeping them adjacent and in the same order everywhere would aid readability.
  • rmSuffix is first-match-wins / order-dependent (cl/ctx.go:459). For overlapping suffixes (e.g. ["ing", "ping"]), "Remapping" would match "ing" first. This matches the pre-existing helper contract (not a regression), but since TypeAbbrSuffix is a new user-facing knob, a note that ordering matters — list longer/more-specific suffixes first — would help. An empty-string entry also short-circuits the loop as a silent no-op.
  • Naming: TypeAbbrSuffix reads like "suffix of an abbreviation" rather than "suffix to strip from the Go type name." The doc comment clarifies intent; an inline example (e.g. "Remapping" -> "Remap") in the comment would make it clearer at a glance.

Comment thread tool/config.go
@xushiwei
xushiwei merged commit bc03424 into goplus:main Sep 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant