Skip to content

[Bug] $stringify with lazy macro argument drops opening bracket of cast #2120

@BWindey

Description

@BWindey

When using $stringify(#arg1) and passing something like (int[]) { 1, 2 } to #arg1, the opening bracket of the cast gets dropped. This behaviour does not occur with passing the expression directly to $stringify.

Here is a miminal reproducible example:

macro void @echoo(#arg1) {
	$echo($stringify(#arg1));
}

fn void main() {
	@echoo((int[]) { 1, 2 });
	$echo($stringify((String) { 50, 0 }));
}

prints out the following during compilation:

] int[]) { 1, 2 }
] (String) { 50, 0 }

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingFixed needs testingNeeds verification / testing that it now works

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions