Commit 030ea75
committed
bugfix(semantic): writeln!(f) with no format string writes a newline.
`writeln!(f)` (a formatter with no format string) errored with "Macro expected
format string argument", though in Rust it writes just a newline. Accept the
no-format-string case for `writeln!` and emit a newline; `write!(f)` still
requires a format string.
This also makes `println!()` valid — it expands to `writeln!(f, )` — matching its
documented "prints an empty line" example, while `print!()` → `write!(f, )` still
errors.1 parent 808c713 commit 030ea75
3 files changed
Lines changed: 29 additions & 15 deletions
File tree
- corelib/src/test
- crates/cairo-lang-semantic/src
- expr/test_data
- inline_macros
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
32 | 42 | | |
33 | 43 | | |
34 | 44 | | |
| |||
Lines changed: 0 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | 578 | | |
584 | 579 | | |
585 | 580 | | |
| |||
943 | 938 | | |
944 | 939 | | |
945 | 940 | | |
946 | | - | |
947 | | - | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | 941 | | |
952 | 942 | | |
953 | 943 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| |||
206 | 207 | | |
207 | 208 | | |
208 | 209 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
213 | 227 | | |
214 | 228 | | |
215 | 229 | | |
| |||
0 commit comments