Skip to content

checker: .byte directive inside an asm block is reported as the deprecated byte type #28739

Description

@quaesitor-scientiam

Describe the bug

Inside an asm block, the assembler directive .byte is reported as the deprecated V type byte:

byte_directive.v:14:3: error: byte is deprecated, use u8 instead

The diagnostic comes from vlib/v/types/checker.v ('byte is deprecated, use u8 instead'), i.e. the checker treats the directive name after . in an asm block as a type identifier. V1 accepted this; vlib/v/slow_tests/assembly/asm_test.amd64.v:174 uses exactly this directive and currently only compiles through the V1 fallback.

Reproduction Steps

fn main() {
	mut a := int(0)
	asm amd64 {
		mov a, [rip + byte_sequence]
		; =r (a)
	}
	assert a == 0x480f3527
	println('ok')
}

asm amd64 {
	.global byte_sequence
	byte_sequence:
	.byte 0x27, 0x35, 0x0f, 0x48
}
v run byte_directive.v

The same block with .long 0x480f3527 instead of .byte ... gets past the checker (and then hits #28738, the top-level asm block not being emitted).

Expected Behavior

.byte is an assembler directive (like .global, .long, .quad); the deprecated-type check must not apply to tokens inside an asm block.

Current Behavior

byte_directive.v:14:3: error: byte is deprecated, use u8 instead
   12 |     .global byte_sequence
   13 |     byte_sequence:
   14 |     .byte 0x27, 0x35, 0x0f, 0x48
      |      ~~~~

Possible Solution

Skip the deprecated-byte type check for identifiers that are part of an asm block (directive names, labels, register names).

Additional Information/Context

Found while checking why vlib/v/slow_tests/assembly/asm_test.amd64.v fails under V3 (it passes in CI only via the V 0.5.2 fallback). Related: #28736 (arch-qualified test files), #28738 (top-level asm block dropped).

V version

V 0.5.2 01a8af9 (master, 2026-09-18)

Environment details

Windows 11 amd64, -cc gcc (mingw64 16.2); V3 compiler.

Activity

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

Metadata

Metadata

Labels

BugThis tag is applied to issues which reports bugs.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions