Skip to content

fix(rtt): Down.mode() uses self.flags instead of self.mode#984

Open
by965738071 wants to merge 1 commit into
ZigEmbeddedGroup:mainfrom
by965738071:fix/rtt-down-mode
Open

fix(rtt): Down.mode() uses self.flags instead of self.mode#984
by965738071 wants to merge 1 commit into
ZigEmbeddedGroup:mainfrom
by965738071:fix/rtt-down-mode

Conversation

@by965738071

Copy link
Copy Markdown
Contributor
  • Bug: Down.mode() referenced self.mode (the method itself) instead of the flags field, causing a compile error on Zig 0.17
  • Fix: changed self.mode to self.flags, matching the Up.mode() pattern
  • Add build.zig test step with 5 unit tests covering mode get/set, Writer/Reader compilation, and Up mode verification
  • Add test for Down set_mode + mode round-trip

- Bug: Down.mode() referenced self.mode (the method itself) instead of
  the flags field, causing a compile error on Zig 0.17
- Fix: changed self.mode to self.flags, matching the Up.mode() pattern
- Add build.zig test step with 5 unit tests covering mode get/set,
  Writer/Reader compilation, and Up mode verification
- Add test for Down set_mode + mode round-trip
@mattnite

Copy link
Copy Markdown
Contributor

How did you test this?

@by965738071

Copy link
Copy Markdown
Contributor Author

The Down.mode() method was dead code — it's never called from outside the module, which is why the bug went unnoticed. Zig only instantiates method bodies when they're used, so the compiler never type-checked it.

I verified the fix by:

  1. Confirming the pattern matches Up.mode() which uses self.flags & 3
  2. Adding unit tests that exercise Down.mode() and set_mode() round-trip

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