fix: suppress V compiler errors for unused params and mutable interface casts#622
Conversation
…ce casts
- Rename unused callback parameters to `_` to suppress "declared but never used" warnings
(accordion, alpha, colorbox, colorsliders, gg_app, grid, rasterview, splitpanel, tabs)
- Fix fontchooser_lb_change: declare fc as mut so DrawTextWidget cast on fc.dtw is valid
- Fix hideable_add_shortcut: use unsafe{} for Shortcutable cast from immutable &ui.Window
- Fix chunkview.v: wrap DrawTextWidget(cv) casts in unsafe{} where cv is &ChunkView
- Fix layout_canvas.v: same unsafe{} treatment for DrawTextWidget(c) from &CanvasLayout
The unsafe{} casts are necessary because V's checker now rejects creating a mutable
interface value from an immutable pointer (&T). The underlying data is heap-allocated
and remains valid; unsafe{} tells the compiler to trust the programmer's intent.
Tracks: vlang/v#26853
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Need to run Suggest also running |
|
Appears to be an issue for both VUI and GUI (Linux box). |
|
Good catch — ran |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
More than one file needed to be formatted. From most recent CI run: |
…tWidget casts
Remaining unused parameters and immutable interface cast issues:
- lb_mouse_up, slider_mouse_up, sw_mouse_up: unused MouseEvent param renamed to _
- DrawTextWidget() calls in immutable-receiver functions in listbox.v and
textbox.v wrapped in unsafe{} to satisfy the type checker
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for the detailed CI output. On the fmt failures: All 36 files were already failing On the build errors: The latest commit (
The remaining build failures ( |
Summary
_to silence V's "declared but never used" errors (accordion,alpha,colorbox,colorsliders,gg_app,grid,rasterview,splitpanel,tabs)fontchooser_lb_change: declarefcasmutso theDrawTextWidgetcast onfc.dtwis validhideable_add_shortcut: useunsafe{}forShortcutablecast from immutable&ui.Windowsrc/chunkview.v: wrapDrawTextWidget(cv)casts inunsafe{}wherecvis&ChunkViewsrc/layout_canvas.v: sameunsafe{}treatment forDrawTextWidget(c)from&CanvasLayoutContext
These are all hard compile errors under the current V compiler (as of April 2026). The
unsafe{}casts forDrawTextWidgetare necessary because V's checker now rejects creating a mutable interface value from an immutable pointer (&T). The underlying data is heap-allocated and valid;unsafe{}tells the compiler to trust the programmer's intent here.This PR is part of effort to restore the
v-apps-compileCI job in vlang/v — tracked at vlang/v#26853.Test plan
vlang/uiwith latest V:v .🤖 Generated with Claude Code