summaryrefslogtreecommitdiff
path: root/test/lspfixture/broken.zig
blob: 22c86c9bbf3fffa7fee5cb35998469a1e9c68121 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! A deliberately defective file, for the lspbench diagnostics and format
//! probes. It is NOT built and NOT imported by anything — `zig build` never
//! sees it, and the snapshot corpus never opens it.
//!
//! Why it exists: on a clean, already-formatted corpus the CORRECT answer to
//! "what is wrong with this file" is nothing, which the harness cannot tell
//! apart from a backend that has no diagnostics at all. That blind spot
//! rewards a backend for emitting a filler row and punishes one for being
//! honest, so the probes point here instead, where there is something real to
//! find:
//!
//!   - `unused_local` is a SEMANTIC error. A tokenizer cannot see it; it takes
//!     a compiler front end (AstGen/ZIR, or `zig ast-check`).
//!   - the spacing in `badly_spaced` is a FORMATTING difference, which only a
//!     formatter reports.
//!
//! Keep both. Removing either silently turns a probe back into a blind one.
pub fn hasUnusedLocal() u32 {
    const unused_local = 41;
    return 7;
}

pub fn badly_spaced (  a : u32 , b : u32 ) u32 {
    return a+b;
}