Documentation
¶
Overview ¶
Two sibling closures each declaring a func-local anonymous struct with the same field names but different field types must not share a type symbol key. The collision left the first literal's Fnew unpatched (nil slice), so building it panicked with "reflect: slice index out of range".
Assigning a method's struct-field return to a captured variable must store a detached copy in the closure cell, not a reflect value aliasing the source field: a later reset of the field (e.g. a pooled object reuse) must not mutate the captured variable. Was zerolog TestSlogHandler_HandlePropagatesContext.
This example demonstrates an integer heap built using the heap interface.
A map composite literal with interface{} values must store raw Go values, not boxed vm.Iface wrappers, so native reflect-based code (json.Marshal) sees the concrete values.
Regression test: %#v on a slice whose element is a defined type with a Format method must qualify the type name and dispatch each element through the user Format body.
An interpreted type satisfying slog.Handler (and slog.LogValuer) across the native boundary: slog.New dispatches Enabled/Handle/WithAttrs/WithGroup via synth method stubs (shapes S32-S36).
Regression test: closure-in-struct dispatch under fmt.Sprintf("%+v") on a recursively wrapped error chain. Mirrors pkg/errors' TestFormatGeneric shape so the bridged Format path stays exercised.
Regression test: closure stored in a struct field, iterated via for-range across nested recursion. Each wrap closure must run its own body; tag and fn must stay in sync.
Source Files
¶
- anon_struct_sibling_closures.go
- array_elem_forward_struct.go
- atomic_pointer_generic.go
- builtin_field_name.go
- builtin_shadow.go
- captured_cell_field_alias.go
- captured_param_cell.go
- cell_native_write_resync.go
- clear_builtin.go
- closure_multi_assign.go
- cmp.go
- comparable_iface.go
- const_fold_arith.go
- const_fold_compare.go
- const_fold_conv.go
- const_fold_div.go
- const_fold_float.go
- const_fold_named.go
- const_fold_precision.go
- context1.go
- context2.go
- dotimport_const.go
- dup_func_decl.go
- embed_mutual_cycle_method.go
- embed_mutual_cycle_promoted.go
- embed_mutual_cycle_ptr.go
- errors_custom_as.go
- errors_custom_is.go
- errors_multierror.go
- fib.go
- fib35.go
- fmt_local_type_name.go
- fmt_stringer_slice.go
- functype_iface_param_slice.go
- functype_paren_return.go
- generic.go
- generic_embedded.go
- generic_forward.go
- generic_infer_call.go
- generic_infer_func.go
- generic_infer_sliceexpr.go
- generic_method_after_use.go
- generic_method_ptr.go
- generic_ptr_type_arg.go
- generic_typeparam_shadows_type.go
- generic_var_infer.go
- global_func_var_field_assign.go
- gob_interface.go
- heap.go
- hexfloat.go
- import1.go
- import2.go
- import3.go
- import4.go
- import_blank_line.go
- import_generic.go
- init0.go
- init1.go
- init2.go
- init_iface.go
- init_indirect_call.go
- init_method.go
- init_order.go
- interface42.go
- intf1.go
- iter1.go
- json_encoder_generic.go
- json_nested_marshaler.go
- json_nested_unmarshaler.go
- json_raw_message.go
- label_var_collision.go
- labeled_jump_range_unwind.go
- make_map_cap_global.go
- map_literal_iface_marshal.go
- map_range_func_store.go
- map_var_key.go
- maps.go
- method_on_nil_generic_ptr.go
- methodorder.go
- named_array_elem_slice.go
- named_basic_identity.go
- named_byte_methods.go
- named_bytes_type_switch.go
- named_func_stringer.go
- named_int_siblings.go
- named_return_defer.go
- named_return_ptr_method.go
- named_return_redef.go
- named_slice_goverbs.go
- nested_exprstmt_popexpr.go
- nil_map_slice_compare.go
- nil_receiver_field.go
- promoted_method_direct_iface.go
- promoted_method_native_iface.go
- promoted_method_value_embed.go
- promoted_ptr_recv_inner_call.go
- ptr_multi_assign_swap.go
- ptr_recv_local_scalar.go
- ptr_recv_named_basic_mutate.go
- ptr_to_generic_conversion.go
- rangefunc1.go
- rangefunc2.go
- rangefunc3.go
- recover_native.go
- recv_stmt_in_loop.go
- rune_callback.go
- rune_reader_synth.go
- runtime_callers.go
- shift_const_float.go
- shift_float.go
- shift_uint64_boundary.go
- shift_untyped_context.go
- short_decl_local_rebind.go
- short_decl_param_rebind.go
- sieve.go
- sieve_loop.go
- slice_expr_result.go
- slices.go
- slices_sortfunc_struct.go
- slog_handler_interp.go
- sort1.go
- sort_slice_stringer.go
- stringer_field.go
- struct19.go
- struct_field_shadow_local.go
- synth_label_collision.go
- type_blank_line.go
- type_forward_in_group.go
- unsafe1.go
- unsafe10.go
- unsafe11.go
- unsafe12.go
- unsafe2.go
- unsafe3.go
- unsafe4.go
- unsafe5.go
- unsafe6.go
- unsafe7.go
- unsafe8.go
- unsafe9.go
- unsafe_slicedata_empty.go
- variadic_funcvalue_call.go
- wrap_chain_format.go
- wrap_chain_repro.go
- xml_custom_marshal.go
- xml_marshal.go
- xml_text_unmarshal.go