cgen: make char literals wide (#7769)
parent
8700080c4a
commit
bf7da14ba1
|
@ -4,3 +4,11 @@ fn test_utf8_char_len() {
|
|||
s := 'п'
|
||||
assert utf8_char_len(s[0]) == 2
|
||||
}
|
||||
|
||||
fn test_utf8_wide_char() {
|
||||
r := `🌎`
|
||||
val := r.str().str
|
||||
unsafe {
|
||||
assert '${val[0]:x}${val[1]:x}${val[2]:x}${val[3]:x}' == 'f09f8c8e'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2452,7 +2452,7 @@ fn (mut g Gen) expr(node ast.Expr) {
|
|||
if node.val == r'\`' {
|
||||
g.write("'`'")
|
||||
} else {
|
||||
g.write("'$node.val'")
|
||||
g.write("L'$node.val'")
|
||||
}
|
||||
}
|
||||
ast.AtExpr {
|
||||
|
|
Loading…
Reference in New Issue