Skip to content

πŸ”₯ remove: Drop an unused parser helper and two needless Sprintf calls - #165

Merged
135yshr merged 2 commits into
mainfrom
claude/next-work-tasks-5b56lt
Sep 27, 2026
Merged

135yshr merged 2 commits into
mainfrom
claude/next-work-tasks-5b56lt

Conversation

@135yshr

@135yshr 135yshr commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Overview

Removes the code nothing can reach, and two fmt.Sprintf calls with nothing to format. Nothing a program does changes.

Removed Why
Parser.prefixPrec (unexported) Unary operators call parseExpr(precUnary) directly, so nothing calls it (staticcheck U1000)
fmt.Sprintf("%s", x) in codegen's genPartialCall x is already a string (S1025)
fmt.Sprintf("Hiss! pipe target is not callable, nya~") in the interpreter No verbs to format (S1039)

Kept on purpose

  • Exported functions with no caller in this repository: meowrt.AsList, Parser.Errors and Environment.Set. The first push removed them. Their packages are importable by other modules, though, so removing them would stop a dependent module compiling on upgrade; Codex review pointed this out. They are restored unchanged. Dropping them belongs in a documented breaking release, if at all.
  • Runtime functions that deadcode reports as unreachable (TryAsByte, AsByte, Nya, And, Or, BuiltinFunc, RunMain, ExitOnFurball): generated programs call them, directly or through RunMain/AsByte. deadcode can't see calls that exist only in Go the compiler generates.
  • TrickType.String/Equals: they are what make TrickType a types.Type.
  • Remaining staticcheck findings: they are style (ST1000 package comments, ST1003 names), not unused code.

The candidates came from staticcheck (the repo's all,-ST1005) and from deadcode -test run for both the native and the WASM (GOOS=js) build.

Found while checking this, not changed here

The spec has a Reassignment section (AssignStmt = identifier "=" Expr, "Rebinds an existing variable to a new value"). No AssignStmt exists, though: nyan x = 1 followed by x = 5 is refused with Variable x already declared in this scope. Whether to implement reassignment or remove that spec section is a language decision, so it is not part of this PR.

Verification

  • go test ./... passes. Every golden prints exactly what it did before, so the codegen change emits the same Go.
  • go vet ./... passes
  • Golden files updated if needed: none moved
  • go build ./... and the WASM playground build
  • staticcheck no longer reports U1000, S1025 or S1039
  • The examples the e2e job runs (hello, fibonacci, fizzbuzz, list_ops) run

Impact

  • Compiler (lexer / parser / checker / codegen): parser, codegen
  • Runtime (meowrt / file / http)
  • CLI
  • Documentation
  • Playground: one Sprintf in the interpreter

AI Session

Checklist

  • I have read the CONTRIBUTING guide
  • My changes follow the project's coding style
  • I have added/updated tests for my changes. No behaviour changes, so the existing suite is the check.
  • Commit messages use gitmoji prefix

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01Scc7p1RecmFoikhcXwnTMu

Summary by CodeRabbit

  • Refactor
    • Simplified internal handling of typed partial applications and pipe expressions. The behavior and resulting error message remain unchanged.
    • Removed an unused internal parser helper. No public interfaces or end-user behavior changed.

- Parser.prefixPrec: unused since unary operators went through
  parseExpr(precUnary) directly (staticcheck U1000).
- Parser.Errors: Parse already returns the same errors, and nothing
  asks for them a second time.
- Environment.Set: the interpreter has no reassignment to use it for.
- meowrt.AsList: codegen unboxes only int, byte, float, string and bool,
  so no generated program calls it.
- Two fmt.Sprintf calls with nothing to format (S1025, S1039).

Every golden and every other test prints what it printed before; the
examples the e2e job runs still run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scc7p1RecmFoikhcXwnTMu
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
πŸ“ Code Review βœ… Completed 2026-09-27T14:03:01.806024Z 94a2778 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with πŸ‘€ while any review is running, comments if it has suggestions, and reacts with πŸ‘ once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack β†’

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: fbc23870-14c4-4ed5-8959-58100f06fca3

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 6143dfe and 7321202.

πŸ“’ Files selected for processing (3)
  • pkg/codegen/codegen.go
  • pkg/interpreter/interpreter.go
  • pkg/parser/parser.go
πŸ’€ Files with no reviewable changes (1)
  • pkg/parser/parser.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


πŸ“ Walkthrough

Walkthrough

The code generator and interpreter simplify expressions without changing their described behavior. The parser removes the unexported prefixPrec helper.

Changes

Code cleanup

Layer / File(s) Summary
Expression and helper cleanup
pkg/codegen/codegen.go, pkg/interpreter/interpreter.go, pkg/parser/parser.go
The code generator simplifies the typed partial-application argument expression. The interpreter uses a string literal for the unchanged panic message. The parser removes prefixPrec.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Refactor

Merge Risk: βšͺ Minimal Β· up to 73212

This cleanup preserves the described behavior and presents no identified merge-blocking risk.

Architecture Summary

Architecture risk: πŸ”΅ Low Β· up to 73212

The change affects 1 system.

Changed systems: pkg

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed β€” pkg (service) was modified; 3 changed files map to changed impact.

Before / after behavior

  • observed β€” Modified behavior in pkg/codegen/codegen.go: Simplifies formatting of the typed partial-application argument expression without changing the generated unboxing call.
  • observed β€” Modified behavior in pkg/interpreter/interpreter.go: The non-callable pipe-target panic now uses a string literal rather than formatting an unchanged message.
  • observed β€” Modified behavior in pkg/parser/parser.go: Removed prefixPrec, which mapped MINUS and NOT to precUnary and all other token types to precNone.
πŸš₯ Pre-merge checks | βœ… 5
βœ… Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check βœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check βœ… Passed Check skipped because no linked issues were found for this pull request.
Title check βœ… Passed The title clearly and concisely describes all three cleanup changes: removing the unused parser helper and two unnecessary Sprintf calls.
Description check βœ… Passed The description covers the required overview, verification, impact, AI session, and checklist sections. It provides detailed rationale and verification results. The Entire-Checkpoint field is not fill…
✨ Finishing Touches
πŸ“ Generate docstrings
  • Commit to this branch
  • Create a new PR
πŸ§ͺ Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

A rabbit hops past lines of code,
Two simpler paths now share the road.
One parser helper takes its leave,
The syntax stays as you perceive.
Soft paws tap, and changes close.

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94a2778567

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread runtime/meowrt/value.go
Parser.Errors, Environment.Set and meowrt.AsList have no caller in this
repository, but their packages are importable, so removing them would
stop a module that uses them compiling on upgrade. Removing exported API
is a decision for a documented release, not part of a cleanup; this one
keeps to what nothing outside can reach.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scc7p1RecmFoikhcXwnTMu
@135yshr 135yshr changed the title πŸ”₯ remove: Drop code nothing calls πŸ”₯ remove: Drop an unused parser helper and two needless Sprintf calls Sep 27, 2026
@135yshr
135yshr merged commit eb058fb into main Sep 27, 2026
4 checks passed
@135yshr
135yshr deleted the claude/next-work-tasks-5b56lt branch September 27, 2026 14:46
135yshr added a commit that referenced this pull request Sep 28, 2026
## Overview

Removes three exported functions that nothing in this repository calls,
and nothing in the Go the compiler generates calls either. PR #165 kept
them because removing exported API breaks any module that imports these
packages. The maintainer has since decided to remove them now, since the
module is still at v0.

| Removed | What to use instead |
| --- | --- |
| `parser.Parser.Errors` | `Parse` already returns the same errors as
its second result |
| `interpreter.Environment.Set` | Nothing: the interpreter has no
reassignment, so nothing sets a binding after it is defined |
| `meowrt.AsList` | `meowrt.TryAsList`, which returns the list, or the
Furball instead of panicking |

### How it reaches the release notes

- `CHANGELOG.md` is generated by semantic-release-gitmoji, and its
template prints only ✨, πŸ›, πŸš‘, πŸ”’ and πŸ’₯ commits. A πŸ’₯ commit would appear
under "Breaking Changes", but it would also cut v1.0.0. So this commit
is πŸ”₯, which cuts no release of its own.
- GoReleaser's changelog groups a commit whose message says `remove`
under **Removed**. So the GitHub release notes of the next release list
this commit, and the commit message carries the replacements above.

## Verification

- [x] `go test ./...` passes
- [x] `go vet ./...` passes
- [x] Golden files updated if needed: none moved
- [x] `go build ./...` and the WASM playground build
- [x] Nothing in the repository references the three names any more
(`TryAsList` stays)
- [x] staticcheck reports nothing new on the changed packages
- [x] The examples the e2e job runs (`hello`, `fibonacci`, `fizzbuzz`,
`list_ops`) run

## Impact

- [x] Compiler (lexer / parser / checker / codegen): parser
- [x] Runtime (meowrt / file / http): `meowrt.AsList`
- [ ] CLI
- [ ] Documentation
- [x] Playground: `interpreter.Environment.Set`

A dependent module that calls one of these stops compiling when it
upgrades. That breaking change is the point of this PR. Generated
programs are unaffected.

## AI Session

- Session URL: https://claude.ai/code/session_01Scc7p1RecmFoikhcXwnTMu

## Checklist

- [x] I have read the [CONTRIBUTING guide](../CONTRIBUTING.md)
- [x] My changes follow the project's coding style
- [x] I have added/updated tests for my changes. Nothing called these,
so the existing suite is the check.
- [x] Commit messages use [gitmoji](https://gitmoji.dev/) prefix

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01Scc7p1RecmFoikhcXwnTMu

---
_Generated by [Claude
Code](https://claude.ai/code/session_01Scc7p1RecmFoikhcXwnTMu)_

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **API Changes**
* Removed the environment method for updating an existing binding, the
parser accessor for accumulated errors, and the list conversion helper.
These methods and helper are no longer available to callers.
* Parser errors remain available as the second result returned by
`Parse`.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants