╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ compile_errors.zig ───────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
157 ":9:11: note: parameter type declared here", 158 }); 159 160 case.addSourceFile("a.zig", 161 \\pub const Foo = struct { 162 \\ x: i32, 163 \\}; 164 ); 165 166 case.addSourceFile("b.zig", 167 \\pub const Foo = struct { 168 \\ z: f64, 169 \\}; 170 ); 171 } 172 173 { 174 const case = ctx.obj("non-printable invalid character", b.graph.host); 175 176 case.addError("\xff\xfe" ++ 177 \\export fn foo() bool { 178 \\ return true; 179 \\} 180 , &[_][]const u8{ 181 ":1:1: error: expected type expression, found 'invalid token'", 182 }); 183 } 184 185 { 186 const case = ctx.obj("imported generic method call with invalid param", b.graph.host); 187 188 case.addError( 189 \\pub const import = @import("import.zig"); 190 \\ 191 \\export fn callComptimeBoolFunctionWithRuntimeBool(x: bool) void { 192 \\ import.comptimeBoolFunction(x); 193 \\} 194 \\ 195 \\export fn callComptimeAnytypeFunctionWithRuntimeBool(x: bool) void { 196 \\ import.comptimeAnytypeFunction(x); 197 \\} 198 \\ 199 \\export fn callAnytypeFunctionWithRuntimeComptimeOnlyType(x: u32) void { 200 \\ const S = struct { x: u32, y: type }; 201 \\ import.anytypeFunction(S{ .x = x, .y = u32 }); 202 \\} 203 , &[_][]const u8{ 204 ":4:33: error: unable to resolve comptime value", 205 ":4:33: note: argument to comptime parameter must be comptime-known", 206 ":1:29: note: parameter declared comptime here", 207 ":8:36: error: unable to resolve comptime value", 208 ":8:36: note: argument to comptime parameter must be comptime-known", 209 ":2:32: note: parameter declared comptime here", 210 ":13:32: error: unable to resolve comptime value", 211 ":13:32: note: initializer of comptime-only struct 'tmp.callAnytypeFunctionWithRuntimeComptimeOnlyType.S' must be comptime-known", 212 ":12:35: note: struct requires comptime because of this field", 213 ":12:35: note: types are not available at runtime", 214 }); 215 216 case.addSourceFile("import.zig", 217 \\pub fn comptimeBoolFunction(comptime _: bool) void {} 218 \\pub fn comptimeAnytypeFunction(comptime _: anytype) void {} 219 \\pub fn anytypeFunction(_: anytype) void {} 220 ); 221 } 222 223 { 224 const case = ctx.obj("invalid byte in string", b.graph.host); 225 226 case.addError("_ = \"\x01Q\";", &[_][]const u8{ 227 ":1:6: error: string literal contains invalid byte: '\\x01'", 228 }); 229 } 230 231 { 232 const case = ctx.obj("invalid byte in comment", b.graph.host); 233 234 case.addError("//\x01Q", &[_][]const u8{ 235 ":1:3: error: comment contains invalid byte: '\\x01'", 236 }); 237 } 238 239 { 240 const case = ctx.obj("control character in character literal", b.graph.host); 241 242 case.addError("const c = '\x01';", &[_][]const u8{ 243 ":1:12: error: character literal contains invalid byte: '\\x01'", 244 }); 245 } 246 247 { 248 const case = ctx.obj("invalid byte at start of token", b.graph.host); 249 250 case.addError("x = \x00Q", &[_][]const u8{ 251 ":1:5: error: expected expression, found 'invalid token'", 252 }); 253 } 254 } 255