mirror of
https://github.com/ruuda/rcl.git
synced 2025-12-23 04:47:19 +00:00
This is again a non-idempotency discovered by the fuzzer. Now an expression in a hole can have blank lines or comments preceding it. I am starting to see a pattern: all expressions (that can contain non- code) need to be preceded by a separator. When they are preceded by nothing (like was the case for the hole) or by a hard-coded space (like was the case for the conditional), we may put a break or comment directly after some content while it should go on its own line. Are there more cases where an expression is not preceded by a separator? I guess the fuzzer will find out!
78 lines
1.3 KiB
Text
78 lines
1.3 KiB
Text
let x = f"This f-string has {
|
|
"a hole"
|
|
} inside it.";
|
|
|
|
let y = f"This f-string has {
|
|
[
|
|
// A list with a comment.
|
|
"in a hole"
|
|
]
|
|
} inside it.";
|
|
|
|
// The next one is a regression test; a bug would drop the content after the
|
|
// hole.
|
|
let k =
|
|
f"""
|
|
{0}t""";
|
|
|
|
let z0 = f"This string \n has an {"escape"} sequence \u{1F574} in it.";
|
|
let z1 = f"""
|
|
As does
|
|
\t this one.
|
|
{"^ Tab above."}
|
|
""";
|
|
|
|
// Here we have a comment inside the hole, which makes it multi-line.
|
|
let hole1 = f"Beware: {
|
|
// A comment
|
|
0
|
|
}";
|
|
let hole1 = f"""
|
|
This one has a blank line instead: {
|
|
|
|
0
|
|
}""";
|
|
|
|
f"""
|
|
This { let strtype = "f"; strtype }-string has a hole too.
|
|
"""
|
|
|
|
# output:
|
|
let x = f"This f-string has {"a hole"} inside it.";
|
|
|
|
let y = f"This f-string has {
|
|
[
|
|
// A list with a comment.
|
|
"in a hole",
|
|
]
|
|
} inside it.";
|
|
|
|
// The next one is a regression test; a bug would drop the content after the
|
|
// hole.
|
|
let k =
|
|
f"""
|
|
{0}t""";
|
|
|
|
let z0 = f"This string \n has an {"escape"} sequence \u{1F574} in it.";
|
|
let z1 =
|
|
f"""
|
|
As does
|
|
\t this one.
|
|
{"^ Tab above."}
|
|
""";
|
|
|
|
// Here we have a comment inside the hole, which makes it multi-line.
|
|
let hole1 = f"Beware: {
|
|
// A comment
|
|
0
|
|
}";
|
|
let hole1 =
|
|
f"""
|
|
This one has a blank line instead: {
|
|
|
|
0
|
|
}""";
|
|
|
|
f"""
|
|
This {let strtype = "f"; strtype}-string has a hole too.
|
|
"""
|