Beef
Beef copied to clipboard
#unwarn in emitted comptime code isn't honored
[Comptime(ConstEval = true)]
public static void UsesUnwarn()
{
Compiler.MixinRoot("""
#unwarn
let field = 123;
""");
}
public static void Main()
{
UsesUnwarn();
UsesUnwarn(); // A variable named 'field' has already been declared in this scope
}
Tested on 09/09/2025. The code above warns about the variable field being reused despite #unwarn being included in the code emitted by the comptime method UsesUnwarn. Per Discord discussion, this is a bug. Manually adding #unwarn successfully hides the warning:
public static void Main()
{
UsesUnwarn();
#unwarn
UsesUnwarn(); // The warning is gone!
}