diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 662a4082b1a957..a61f75b0ded71c 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -3013,6 +3013,10 @@ pub fn (mut c Checker) expr(mut node ast.Expr) ast.Type { // string literal starts with "c": `C.printf(c'hello')` return ast.u8_type.set_nr_muls(1) } + if node.is_raw { + // raw strings don't need any sort of checking related to unicode + return ast.string_type + } return c.string_lit(mut node) } ast.StringInterLiteral { diff --git a/vlib/v/tests/raw_string_test.v b/vlib/v/tests/raw_string_test.v index 5dad86a7b63992..ae894344bf8c06 100644 --- a/vlib/v/tests/raw_string_test.v +++ b/vlib/v/tests/raw_string_test.v @@ -17,6 +17,11 @@ fn test_raw_string_not_escaped_by_transformer() { assert 'a\nb' + r'a\nb' == 'a\nba\\nb' } +fn test_raw_string_backslash_u() { + assert r'\u0000004B' == r'\u0000004B' + println(r'\u0000004B') +} + // this test will cause test failure (see #12604) // fn test_many_pluses() { // a := r'x\n'