oxedyne/fe2o3/fe2o3_austenite/tests/fixtures/eval/core/errors.txt
9.8 KiB, 1 run
created by r1870400018:63758, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | ;; U2 error cases, in the same form as `values.txt`. The expected text is the first `error:` line |
| 2 | ;; `typst eval` prints for the code. |
| 3 | %% 1 + "a" |
| 4 | (Binary 1 Plus "a") |
| 5 | %% 1 / 0 |
| 6 | (Binary 1 Slash 0) |
| 7 | %% 1 < "a" |
| 8 | (Binary 1 Lt "a") |
| 9 | %% not 1 |
| 10 | (Unary Not 1) |
| 11 | %% x |
| 12 | x |
| 13 | %% {let x = 1; let f() = { x = 2 }; f()} |
| 14 | (CodeBlock LeftBrace (Code (LetBinding Let x Eq 1) Semicolon (LetBinding Let (Closure f (Params LeftParen RightParen) Eq (CodeBlock LeftBrace (Code (Binary x Eq 2)) RightBrace))) Semicolon (FuncCall f (Args LeftParen RightParen))) RightBrace) |
| 15 | %% {let (a, b) = (1,); a} |
| 16 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen a Comma b RightParen) Eq (Array LeftParen 1 Comma RightParen)) Semicolon a) RightBrace) |
| 17 | %% {let (a, b) = (1, 2, 3); a} |
| 18 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen a Comma b RightParen) Eq (Array LeftParen 1 Comma 2 Comma 3 RightParen)) Semicolon a) RightBrace) |
| 19 | %% {let (x, y) = 3; x} |
| 20 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen x Comma y RightParen) Eq 3) Semicolon x) RightBrace) |
| 21 | %% {let (a: b) = (1, 2); b} |
| 22 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen (Named a Colon b) RightParen) Eq (Array LeftParen 1 Comma 2 RightParen)) Semicolon b) RightBrace) |
| 23 | %% {let (a, (b, c)) = (a: 1); a} |
| 24 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen a Comma (Destructuring LeftParen b Comma c RightParen) RightParen) Eq (Dict LeftParen (Named a Colon 1) RightParen)) Semicolon a) RightBrace) |
| 25 | %% {let (z,) = (a: 1); z} |
| 26 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen z Comma RightParen) Eq (Dict LeftParen (Named a Colon 1) RightParen)) Semicolon z) RightBrace) |
| 27 | %% heading = 3 |
| 28 | (Binary heading Eq 3) |
| 29 | %% {break} |
| 30 | (CodeBlock LeftBrace (Code (LoopBreak Break)) RightBrace) |
| 31 | %% {continue} |
| 32 | (CodeBlock LeftBrace (Code (LoopContinue Continue)) RightBrace) |
| 33 | %% {return 1} |
| 34 | (CodeBlock LeftBrace (Code (FuncReturn Return 1)) RightBrace) |
| 35 | %% (1, 2).nope() |
| 36 | (FuncCall (FieldAccess (Array LeftParen 1 Comma 2 RightParen) Dot nope) (Args LeftParen RightParen)) |
| 37 | %% {let d = (f: x => x); d.f(1)} |
| 38 | (CodeBlock LeftBrace (Code (LetBinding Let d Eq (Dict LeftParen (Named f Colon (Closure (Params x) Arrow x)) RightParen)) Semicolon (FuncCall (FieldAccess d Dot f) (Args LeftParen 1 RightParen))) RightBrace) |
| 39 | %% 9223372036854775807 + 1 |
| 40 | (Binary 9223372036854775807 Plus 1) |
| 41 | %% {let d = (a: 1); d.at("b") = 2; d} |
| 42 | (CodeBlock LeftBrace (Code (LetBinding Let d Eq (Dict LeftParen (Named a Colon 1) RightParen)) Semicolon (Binary (FuncCall (FieldAccess d Dot at) (Args LeftParen "b" RightParen)) Eq 2) Semicolon d) RightBrace) |
| 43 | %% {let a = (1, 2); a.at(5) = 2; a} |
| 44 | (CodeBlock LeftBrace (Code (LetBinding Let a Eq (Array LeftParen 1 Comma 2 RightParen)) Semicolon (Binary (FuncCall (FieldAccess a Dot at) (Args LeftParen 5 RightParen)) Eq 2) Semicolon a) RightBrace) |
| 45 | %% {let d = (a: 1); d.b += 1} |
| 46 | (CodeBlock LeftBrace (Code (LetBinding Let d Eq (Dict LeftParen (Named a Colon 1) RightParen)) Semicolon (Binary (FieldAccess d Dot b) PlusEq 1)) RightBrace) |
| 47 | %% {let f(x) = x; f()} |
| 48 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen x RightParen) Eq x)) Semicolon (FuncCall f (Args LeftParen RightParen))) RightBrace) |
| 49 | %% {let f(x) = x; f(1, 2)} |
| 50 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen x RightParen) Eq x)) Semicolon (FuncCall f (Args LeftParen 1 Comma 2 RightParen))) RightBrace) |
| 51 | %% {let f(x) = x; f(1, a: 2)} |
| 52 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen x RightParen) Eq x)) Semicolon (FuncCall f (Args LeftParen 1 Comma (Named a Colon 2) RightParen))) RightBrace) |
| 53 | %% (1,).push(2) |
| 54 | (FuncCall (FieldAccess (Array LeftParen 1 Comma RightParen) Dot push) (Args LeftParen 2 RightParen)) |
| 55 | %% {let a = (); a.pop()} |
| 56 | (CodeBlock LeftBrace (Code (LetBinding Let a Eq (Array LeftParen RightParen)) Semicolon (FuncCall (FieldAccess a Dot pop) (Args LeftParen RightParen))) RightBrace) |
| 57 | %% {let a = (1, 2); a.remove(5)} |
| 58 | (CodeBlock LeftBrace (Code (LetBinding Let a Eq (Array LeftParen 1 Comma 2 RightParen)) Semicolon (FuncCall (FieldAccess a Dot remove) (Args LeftParen 5 RightParen))) RightBrace) |
| 59 | %% {let a = (1, 2); a.insert(3, 0)} |
| 60 | (CodeBlock LeftBrace (Code (LetBinding Let a Eq (Array LeftParen 1 Comma 2 RightParen)) Semicolon (FuncCall (FieldAccess a Dot insert) (Args LeftParen 3 Comma 0 RightParen))) RightBrace) |
| 61 | %% {let d = (a: 1); d.remove("b")} |
| 62 | (CodeBlock LeftBrace (Code (LetBinding Let d Eq (Dict LeftParen (Named a Colon 1) RightParen)) Semicolon (FuncCall (FieldAccess d Dot remove) (Args LeftParen "b" RightParen))) RightBrace) |
| 63 | %% {let s = "abc"; s.push(1)} |
| 64 | (CodeBlock LeftBrace (Code (LetBinding Let s Eq "abc") Semicolon (FuncCall (FieldAccess s Dot push) (Args LeftParen 1 RightParen))) RightBrace) |
| 65 | %% {let x = 1pt; x.abs = 2pt} |
| 66 | (CodeBlock LeftBrace (Code (LetBinding Let x Eq 1pt) Semicolon (Binary (FieldAccess x Dot abs) Eq 2pt)) RightBrace) |
| 67 | %% {let x = [a]; x.body = 2pt} |
| 68 | (CodeBlock LeftBrace (Code (LetBinding Let x Eq (ContentBlock LeftBracket (Markup (Text 'a')) RightBracket)) Semicolon (Binary (FieldAccess x Dot body) Eq 2pt)) RightBrace) |
| 69 | %% {let x = 1; x.y = 2} |
| 70 | (CodeBlock LeftBrace (Code (LetBinding Let x Eq 1) Semicolon (Binary (FieldAccess x Dot y) Eq 2)) RightBrace) |
| 71 | %% (1 + 2) = 3 |
| 72 | (Binary (Parenthesized LeftParen (Binary 1 Plus 2) RightParen) Eq 3) |
| 73 | %% if 1 {} |
| 74 | (Conditional If 1 (CodeBlock LeftBrace (Code) RightBrace)) |
| 75 | %% {let i = 0; while i < 20000 { i += 1 }; i} |
| 76 | (CodeBlock LeftBrace (Code (LetBinding Let i Eq 0) Semicolon (WhileLoop While (Binary i Lt 20000) (CodeBlock LeftBrace (Code (Binary i PlusEq 1)) RightBrace)) Semicolon i) RightBrace) |
| 77 | %% {while true {}} |
| 78 | (CodeBlock LeftBrace (Code (WhileLoop While true (CodeBlock LeftBrace (Code) RightBrace))) RightBrace) |
| 79 | %% for x in 1 {} |
| 80 | (ForLoop For x In 1 (CodeBlock LeftBrace (Code) RightBrace)) |
| 81 | %% {for (a, b) in "ab" {}} |
| 82 | (CodeBlock LeftBrace (Code (ForLoop For (Destructuring LeftParen a Comma b RightParen) In "ab" (CodeBlock LeftBrace (Code) RightBrace))) RightBrace) |
| 83 | %% (1).nope() |
| 84 | (FuncCall (FieldAccess (Parenthesized LeftParen 1 RightParen) Dot nope) (Args LeftParen RightParen)) |
| 85 | %% 3() |
| 86 | (FuncCall 3 (Args LeftParen RightParen)) |
| 87 | %% none.x |
| 88 | (FieldAccess none Dot x) |
| 89 | %% (1pt).nope |
| 90 | (FieldAccess (Parenthesized LeftParen 1pt RightParen) Dot nope) |
| 91 | %% (a: 1).b |
| 92 | (FieldAccess (Dict LeftParen (Named a Colon 1) RightParen) Dot b) |
| 93 | %% "a".b |
| 94 | (FieldAccess "a" Dot b) |
| 95 | %% heading.nope |
| 96 | (FieldAccess heading Dot nope) |
| 97 | %% [x].nope |
| 98 | (FieldAccess (ContentBlock LeftBracket (Markup (Text 'x')) RightBracket) Dot nope) |
| 99 | %% [x].at("y") |
| 100 | (FuncCall (FieldAccess (ContentBlock LeftBracket (Markup (Text 'x')) RightBracket) Dot at) (Args LeftParen "y" RightParen)) |
| 101 | %% (..(a: 1),) |
| 102 | (Array LeftParen (Spread Dots (Dict LeftParen (Named a Colon 1) RightParen)) Comma RightParen) |
| 103 | %% (a: 1, ..(1,)) |
| 104 | (Dict LeftParen (Named a Colon 1) Comma (Spread Dots (Array LeftParen 1 Comma RightParen)) RightParen) |
| 105 | %% {let f(..r) = r; f(..1)} |
| 106 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen (Spread Dots r) RightParen) Eq r)) Semicolon (FuncCall f (Args LeftParen (Spread Dots 1) RightParen))) RightBrace) |
| 107 | %% {show "": it => it} |
| 108 | (CodeBlock LeftBrace (Code (ShowRule Show "" Colon (Closure (Params it) Arrow it))) RightBrace) |
| 109 | %% {show heading: 5} |
| 110 | (CodeBlock LeftBrace (Code (ShowRule Show heading Colon 5)) RightBrace) |
| 111 | %% {show 1: it => it} |
| 112 | (CodeBlock LeftBrace (Code (ShowRule Show 1 Colon (Closure (Params it) Arrow it))) RightBrace) |
| 113 | %% {set heading(level: 1) if 1} |
| 114 | (CodeBlock LeftBrace (Code (SetRule Set heading (Args LeftParen (Named level Colon 1) RightParen) If 1)) RightBrace) |
| 115 | %% {let f(x) = x; set f(x: 1)} |
| 116 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen x RightParen) Eq x)) Semicolon (SetRule Set f (Args LeftParen (Named x Colon 1) RightParen))) RightBrace) |
| 117 | %% true and 1 |
| 118 | (Binary true And 1) |
| 119 | %% 1 or true |
| 120 | (Binary 1 Or true) |
| 121 | %% +"a" |
| 122 | (Unary Plus "a") |
| 123 | %% -"a" |
| 124 | (Unary Minus "a") |
| 125 | %% 2 - 1pt |
| 126 | (Binary 2 Minus 1pt) |
| 127 | %% 1pt * 1pt |
| 128 | (Binary 1pt Star 1pt) |
| 129 | %% "a" / 2 |
| 130 | (Binary "a" Slash 2) |
| 131 | %% {1; 2} |
| 132 | (CodeBlock LeftBrace (Code 1 Semicolon 2) RightBrace) |
| 133 | %% {[a]; 2} |
| 134 | (CodeBlock LeftBrace (Code (ContentBlock LeftBracket (Markup (Text 'a')) RightBracket) Semicolon 2) RightBrace) |
| 135 | %% "a" * -1 |
| 136 | (Binary "a" Star (Unary Minus 1)) |
| 137 | %% 1 in 2 |
| 138 | (Binary 1 In 2) |
| 139 | %% (1pt + 1em) / 1pt |
| 140 | (Binary (Parenthesized LeftParen (Binary 1pt Plus 1em) RightParen) Slash 1pt) |
| 141 | %% {let f(n) = f(n + 1); f(0)} |
| 142 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen n RightParen) Eq (FuncCall f (Args LeftParen (Binary n Plus 1) RightParen)))) Semicolon (FuncCall f (Args LeftParen 0 RightParen))) RightBrace) |
| 143 | %% {for x in (1, 2) { x }} |
| 144 | (CodeBlock LeftBrace (Code (ForLoop For x In (Array LeftParen 1 Comma 2 RightParen) (CodeBlock LeftBrace (Code x) RightBrace))) RightBrace) |
| 145 | %% [a <l>].label |
| 146 | (FieldAccess (ContentBlock LeftBracket (Markup (Text 'a') Space (Label '<l>')) RightBracket) Dot label) |
| 147 | %% {let f(..r) = r; f(1, a: 2).at(3)} |
| 148 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen (Spread Dots r) RightParen) Eq r)) Semicolon (FuncCall (FieldAccess (FuncCall f (Args LeftParen 1 Comma (Named a Colon 2) RightParen)) Dot at) (Args LeftParen 3 RightParen))) RightBrace) |
| 149 | %% {import list: nope} |
| 150 | (CodeBlock LeftBrace (Code (ModuleImport Import list Colon (ImportItems (ImportItemPath nope)))) RightBrace) |
| 151 | %% {let f(x) = x; import f: a} |
| 152 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen x RightParen) Eq x)) Semicolon (ModuleImport Import f Colon (ImportItems (ImportItemPath a)))) RightBrace) |
| 153 | %% {import 1: a} |
| 154 | (CodeBlock LeftBrace (Code (ModuleImport Import 1 Colon (ImportItems (ImportItemPath a)))) RightBrace) |
| 155 | ;; Set rules cast their values as construction does (no hand tree: parser only). |
| 156 | %% [#set rect(stroke: 5)] |
| 157 | %% [#set rect(radius: "a")] |
| 158 | %%[U3] [#set rect(inset: red)] |
| 159 | %% [#set line(start: 3)] |
| 160 | %% [#set curve(fill-rule: "x")] |
| 161 | %% [#set rotate(origin: 5)] |
| 162 | %% [#set repeat(gap: 50%)] |
| 163 | %% [#set rect(fill: 1pt)] |