Skip to content

Fix doc comments: use /// and remove blank lines before class defs#1019

Merged
jamesc merged 1 commit intomainfrom
worktree-docs/comments
Feb 28, 2026
Merged

Fix doc comments: use /// and remove blank lines before class defs#1019
jamesc merged 1 commit intomainfrom
worktree-docs/comments

Conversation

@jamesc
Copy link
Owner

@jamesc jamesc commented Feb 28, 2026

Summary

  • Fixed all example .bt files (49 files) that used // instead of /// for class-level doc comments — doc comments were never being attached to AST nodes
  • Removed blank lines between doc comment blocks and class definitions — collect_doc_comment() resets on blank lines (>1 newline), silently dropping the comment
  • Fixed 6 stdlib/src/ files (Boolean, ClassBuilder, False, True, TestResult, TestRunner) that had the blank line issue with existing /// comments

Test plan

  • just test — 5038 tests pass
  • just test-stdlib — 237 tests pass
  • All lint checks pass (pre-push hook)
  • Verified representative diffs: only //→/// and blank line removal, no content changes

Follow-up

  • BT-980: Lint warning for unattached /// doc comments (prevents this from recurring)

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Documentation

    • Updated documentation comments across all examples and stdlib modules to use modern triple-slash doc-comment syntax for improved clarity and consistency.
  • New Features

    • Expanded example implementations with complete public APIs: added methods and accessors to Counter, Bank, Chat, Observer, and other pattern examples.
    • Implemented missing core functionality in examples including Hanoi's recursive solver, Adapter pattern with conversion, Builder pattern with fluent interface, and Composite pattern with tree operations.
    • Enhanced example modules with new actor types, transaction tracking, and messaging capabilities.

…ions

All example files used // instead of /// for class-level doc comments,
and had blank lines between the comment block and the class definition.
Both issues prevented doc comments from being attached to AST nodes
(collect_doc_comment resets on blank lines and // comments). Also fixed
6 stdlib/src files (Boolean, ClassBuilder, False, True, TestResult,
TestRunner) that had blank lines before their class definitions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 28, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between 30efa39 and 27554b9.

📒 Files selected for processing (55)
  • examples/bank/src/account.bt
  • examples/bank/src/bank.bt
  • examples/bank/src/transaction.bt
  • examples/bank/src/transfer_agent.bt
  • examples/bank/src/typed_account.bt
  • examples/chat-room/src/chat_member.bt
  • examples/chat-room/src/chat_room.bt
  • examples/chat-room/src/message.bt
  • examples/chat-room/src/moderator.bt
  • examples/getting-started/src/counter.bt
  • examples/getting-started/src/hanoi.bt
  • examples/getting-started/src/hello.bt
  • examples/getting-started/src/logging_counter.bt
  • examples/getting-started/src/point.bt
  • examples/getting-started/src/protoobject_proxy.bt
  • examples/gof-patterns/src/adapter/celsius_thermometer.bt
  • examples/gof-patterns/src/adapter/celsius_to_fahrenheit_adapter.bt
  • examples/gof-patterns/src/adapter/fahrenheit_thermometer.bt
  • examples/gof-patterns/src/builder/html_builder.bt
  • examples/gof-patterns/src/builder/html_element.bt
  • examples/gof-patterns/src/command/command_history.bt
  • examples/gof-patterns/src/command/delete_command.bt
  • examples/gof-patterns/src/command/insert_command.bt
  • examples/gof-patterns/src/command/text_buffer.bt
  • examples/gof-patterns/src/command/text_command.bt
  • examples/gof-patterns/src/composite/fs_dir.bt
  • examples/gof-patterns/src/composite/fs_entry.bt
  • examples/gof-patterns/src/composite/fs_file.bt
  • examples/gof-patterns/src/decorator/beverage.bt
  • examples/gof-patterns/src/decorator/condiment_decorator.bt
  • examples/gof-patterns/src/decorator/espresso.bt
  • examples/gof-patterns/src/decorator/house_blend.bt
  • examples/gof-patterns/src/decorator/milk.bt
  • examples/gof-patterns/src/decorator/sugar.bt
  • examples/gof-patterns/src/decorator/whipped_cream.bt
  • examples/gof-patterns/src/factory_method/circle.bt
  • examples/gof-patterns/src/factory_method/circle_factory.bt
  • examples/gof-patterns/src/factory_method/rectangle.bt
  • examples/gof-patterns/src/factory_method/rectangle_factory.bt
  • examples/gof-patterns/src/factory_method/shape.bt
  • examples/gof-patterns/src/factory_method/shape_factory.bt
  • examples/gof-patterns/src/main.bt
  • examples/gof-patterns/src/observer/event_bus.bt
  • examples/gof-patterns/src/observer/event_collector.bt
  • examples/gof-patterns/src/singleton/app_logger.bt
  • examples/gof-patterns/src/strategy/sorter.bt
  • examples/gof-patterns/src/template_method/csv_exporter.bt
  • examples/gof-patterns/src/template_method/data_exporter.bt
  • examples/gof-patterns/src/template_method/html_exporter.bt
  • stdlib/src/Boolean.bt
  • stdlib/src/ClassBuilder.bt
  • stdlib/src/False.bt
  • stdlib/src/TestResult.bt
  • stdlib/src/TestRunner.bt
  • stdlib/src/True.bt

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch worktree-docs/comments

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

@jamesc jamesc merged commit d755625 into main Feb 28, 2026
4 of 5 checks passed
@jamesc jamesc deleted the worktree-docs/comments branch February 28, 2026 23:15
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