gno icon indicating copy to clipboard operation
gno copied to clipboard

Fix mempackage type

Open piux2 opened this issue 6 months ago • 1 comments

this PR fixed the following errors in the stdlibs in this branch

$ go run ./cmd/gno test -v ./stdlibs/bufio
stdlibs/bufio/scan_test.gno:23:12: undefined: bufio.IsSpace (code=gnoTypeCheckError)
stdlibs/bufio/scan_test.gno:193:4: s.MaxTokenSize undefined (type *bufio.Scanner has no field or method MaxTokenSize, but does have unexported field maxTokenSize) (code=gnoTypeCheckError)
stdlibs/bufio/scan_test.gno:229:4: s.MaxTokenSize undefined (type *bufio.Scanner has no field or method MaxTokenSize, but does have unexported field maxTokenSize) (code=gnoTypeCheckError)
stdlibs/bufio/scan_test.gno:353:9: s.ErrOrEOF undefined (type *bufio.Scanner has no field or method ErrOrEOF) (code=gnoTypeCheckError)
stdlibs/bufio/scan_test.gno:408:10: scanner.MaxTokenSize undefined (type *bufio.Scanner has no field or method MaxTokenSize, but does have unexported field maxTokenSize) (code=gnoTypeCheckError)

 go run ./cmd/gno test -v ./stdlibs/bytes
 go run ./cmd/gno test -v ./stdlibs/io
 go run ./cmd/gno test -v ./stdlibs/math
 go run ./cmd/gno test -v ./stdlibs/math/bits
go run ./cmd/gno test -v ./stdlibs/strconv

The root issue:

There are exported variables, such as the IsSpace function in stdlibs/bufio/export_test.gno, that are part of the bufio package and intended to be used only during testing.

The file stdlibs/bufio/scan_test.go belongs to the bufio_test package instead of bufio ( it is declared in the code even though it is in the same bufio directy, so it needs to import from the bufio package as testing package during testing

However, export_test.gno is not imported in this case by the package bufio_test. The type checker treats bufio as a production package and filters out export_test.gno.

piux2 avatar Jun 19 '25 06:06 piux2

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • [ ] IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

No automated checks match this pull request.

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

Gno2D2 avatar Jun 19 '25 06:06 Gno2D2

This has already been addressed by other fixes in the mempackage_type branch.

piux2 avatar Jun 26 '25 01:06 piux2