Skip to content

Print local interface range values, their %T, and compare array rows (DEV-164) - #219

Open
tylerlaprade wants to merge 2 commits into
masterfrom
claude/print-interface-range-var
Open

tylerlaprade wants to merge 2 commits into
masterfrom
claude/print-interface-range-var

Conversation

@tylerlaprade

@tylerlaprade tylerlaprade commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Fixes DEV-164, found by a realistic probe program.

  • Printing a local interface value taken from a range loop now compiles. The bare-interface print shortcut skips wrapped range variables.
  • %T of a local interface value prints the dynamic type (main.Circle, *main.Rect), not the interface name.
  • grid[i] == grid[j] on rows of [][3]int or []Point compiles. Array and struct elements of slices and arrays are no longer unwrapped as cells.
  • A pointer implementor prints &{...} like Go, or calls the pointee's String when *T has one. This changes the generated Display impl in 73 snapshots; outputs are unchanged.

New fixtures: tests/interface_range_print_and_row_compare and _goroutines. New Go tests in go/interface_range_print_test.go. Ratchet unchanged (33 known).

— agent: claude-chat


Generated by Claude Code

Summary by Sourcery

Fix local interface formatting and composite-value comparisons to match Go semantics.

New Features:

  • Support printing local interface values captured by range loops and report their dynamic types with %T.
  • Allow comparisons of array rows and struct elements stored in slices or arrays.

Bug Fixes:

  • Correct pointer-implementor formatting to match Go output, including pointee String methods and struct pointer formatting.

Enhancements:

  • Track Go dynamic type names for local interface implementations and preserve correct handling of wrapped range variables.

Tests:

  • Add direct and goroutine regression fixtures covering interface range printing, dynamic type formatting, pointer output, and array/struct comparisons.

Chores:

  • Regenerate affected snapshots for the updated pointer display behavior.

…(DEV-164)

Ranging over a slice of a local interface and printing the element did not
compile: the bare-interface print shortcut assumed an unwrapped value, but a
range variable is a wrapped cell. %T on a local interface printed the
interface name instead of the dynamic type. Comparing rows of [][3]int or
[]Point unwrapped the element as a cell. A pointer implementor printed as an
address rather than &{...}, ignoring a String method on *T.

- rangeVarHoldsWrappedCell keeps wrapped range vars off the shortcut.
- writeLocalInterfaceTypeNameFormatArg registers Go type names for the
  current package's implementors (including the *T wrapper) and prints
  __go_type_name of the dynamic value.
- sequenceElementIsBareValue makes NeedsUnwrapping false for array and
  struct elements of slices and arrays.
- pointerLocalInterfaceWrapperDisplay prints &{...}, or the pointee's
  String when *T has one. This changes the Display impl in 73 snapshots.

Agent: claude-chat
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TkCXVghVg3khqYkpQSWyEM
@tylerlaprade tylerlaprade added the agent:claude-chat Work by the Claude chat agent (claude.ai session), acting as the repo owner label Nov 24, 2026 — with Claude
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-24T14:29:49.234391Z
We couldn’t complete this review. Comment @codex review to try again.
16c4b88 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 Nov 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c12d0dea-8e00-48c2-9ec4-5d405aa95747
Commits

Reviewing files that changed from the base of the PR and between 95af5ac and 16c4b88.

Files selected for processing: 87

  • go/context.go
  • go/decl.go
  • go/interface_range_print_test.go
  • go/stdlib.go
  • go/typeinfo.go
  • tests.bats
  • tests/chan_any_values/main.rs
  • tests/channel_interface_events/main.rs
  • tests/channel_interface_values/main.rs
  • tests/closure_rebound_handle_capture/main.rs
  • tests/concrete_reassigned_to_interface_var/main.rs
  • tests/concurrent_package_pointer_global/main.rs
  • tests/concurrent_repeated_interface_field_call_args/main.rs
  • tests/cross_file_interface_impl/circle.rs
  • tests/error_equivalent_interface/main.rs
  • tests/error_equivalent_interface_goroutines/main.rs
  • tests/fmt_sprint_and_sprintln/main.rs
  • tests/fmt_sprint_and_sprintln_goroutines/main.rs
  • tests/fprintf_printer_writer_pattern/main.rs
  • tests/fprintf_user_defined_writer/main.rs
  • tests/fprintln_writers/main.rs
  • tests/function_local_interface_impls/main.rs
  • tests/function_local_interface_impls_goroutines/main.rs
  • tests/generic_pointer_interface_type_arg/main.rs
  • tests/generic_type_param_method_call/main.rs
  • tests/interface_arg_wrapped_struct_field/main.rs
  • tests/interface_assertion_skips_builtin_stub_types/main.rs
  • tests/interface_assertion_skips_builtin_stub_types_goroutines/main.rs
  • tests/interface_embed_upcast/main.rs
  • tests/interface_embedded_method/main.rs
  • tests/interface_embedding_two_interfaces/main.rs
  • tests/interface_embedding_two_interfaces_goroutines/main.rs
  • tests/interface_field_selector_assign/main.rs
  • tests/interface_mutating_method_dispatch/main.rs
  • tests/interface_range_print_and_row_compare/Cargo.toml
  • tests/interface_range_print_and_row_compare/expected_output.txt
  • tests/interface_range_print_and_row_compare/main.go
  • tests/interface_range_print_and_row_compare/main.rs
  • tests/interface_range_print_and_row_compare_goroutines/Cargo.toml
  • tests/interface_range_print_and_row_compare_goroutines/expected_output.txt
  • tests/interface_range_print_and_row_compare_goroutines/main.go
  • tests/interface_range_print_and_row_compare_goroutines/main.rs
  • tests/interface_slice_index_arg/main.rs
  • tests/interface_slice_index_var_decl/main.rs
  • tests/interface_slice_literal_concrete_elems/main.rs
  • tests/interface_slice_literal_long/main.rs
  • tests/interface_slice_literal_long_goroutines/main.rs
  • tests/interface_slice_method_call/main.rs
  • tests/interface_slice_nil_element/main.rs
  • tests/interface_values_are_copied/main.rs
  • tests/interface_values_are_copied_goroutines/main.rs
  • tests/interfaces_basic/main.rs
  • tests/interfaces_simple/main.rs
  • tests/local_concrete_stdlib_interface_return/main.rs
  • tests/local_interface_concrete_return/main.rs
  • tests/local_interface_equality_contains/main.rs
  • tests/local_interface_function_type_assertion/main.rs
  • tests/local_interface_map_pointer_key_reboxed/main.rs
  • tests/local_interface_method_param/main.rs
  • tests/local_interface_pointer_identity_equality/main.rs
  • tests/local_interface_pointer_receiver/main.rs
  • tests/local_interface_pointer_type_switch/main.rs
  • tests/make_interface_slice/main.rs
  • tests/multi_file_method_interface_impl/counter_step.rs
  • tests/named_interface_struct_equality/main.rs
  • tests/named_interface_struct_equality_goroutines/main.rs
  • tests/nested_structures/main.rs
  • tests/nil_receiver_methods/main.rs
  • tests/nil_receiver_methods_goroutines/main.rs
  • tests/pointer_slice_element_boxed_as_interface/main.rs
  • tests/printf_verbs_without_a_rust_equivalent_goroutines/main.rs
  • tests/query_builder_and_any_arguments/main.rs
  • tests/query_builder_and_any_arguments_goroutines/main.rs
  • tests/shadowed_range_var_field_assign/main.rs
  • tests/sort_func_interface_param_call/main.rs
  • tests/sort_func_interface_slice/main.rs
  • tests/source_stdlib_go_parser_types_check_bridge_arg/main.rs
  • tests/struct_embedding/main.rs
  • tests/struct_field_conversion_interface_box/main.rs
  • tests/struct_pointer_identity/main.rs
  • tests/struct_pointer_identity_goroutines/main.rs
  • tests/struct_value_copy_stored/main.rs
  • tests/struct_value_copy_stored_goroutines/main.rs
  • tests/type_assertions/main.rs
  • tests/type_switch_local_interface/main.rs
  • tests/var_decl_concrete_to_interface_box/main.rs
  • tests/variadic_local_interface_element/main.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@sourcery-ai

sourcery-ai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Sorry @tylerlaprade, this account has used its review budget of 1,500,000 diff characters for the last 7 days.

You can request another review in 1 day and 11 hours by commenting @sourcery-ai review. Upgrade to get a review now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:claude-chat Work by the Claude chat agent (claude.ai session), acting as the repo owner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants