diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 8e4ebe82c6..36f24fafe4 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -1977,7 +1977,11 @@ pub fn (mut f Fmt) comptime_call(node ast.ComptimeCall) { f.write("\$pkgconfig('${node.args_var}')") } node.method_name in ['compile_error', 'compile_warn'] { - f.write("\$${node.method_name}('${node.args_var}')") + if node.args_var.contains("'") { + f.write('\$${node.method_name}("${node.args_var}")') + } else { + f.write("\$${node.method_name}('${node.args_var}')") + } } node.method_name == 'res' { if node.args_var != '' { diff --git a/vlib/v/fmt/tests/comptime_call_keep.vv b/vlib/v/fmt/tests/comptime_call_keep.vv new file mode 100644 index 0000000000..66ede5133e --- /dev/null +++ b/vlib/v/fmt/tests/comptime_call_keep.vv @@ -0,0 +1,5 @@ +$if linux { + $compile_error("This won't be formatted correctly by v fmt :')") +} + +fn main() {}