summaryrefslogtreecommitdiff
path: root/test/lspfixture/dothalf.zig
blob: 69d407fa130a336f64936344dde015f618a9bf45 (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
//! The other half of a real keypress, for the lspbench completion probe. Like
//! broken.zig and dotcomplete.zig it is NOT built and NOT imported by anything.
//!
//! dotcomplete.zig types its dot into a switch whose braces are already there,
//! which turns out to be the EASY half: the dot is the only thing wrong with
//! the file, so any repair at all makes the tree whole. Mid-typing a line is
//! short of its terminator as well, and `const z: Shade = .` is then exactly
//! ONE parse error whether a placeholder identifier is spliced in or not. A
//! repair chosen by counting parse errors therefore discards itself here, and
//! the feature silently only worked on finished syntax — which is what this
//! file exists to stop happening again.
//!
//! It is its own file rather than another function in dotcomplete.zig, and
//! that is load-bearing: Zig's error recovery runs FORWARD, so an unrepaired
//! break earlier in a file swallows the declaration the cursor is in. Only the
//! break at the cursor is repaired, so a fixture may hold only one.
pub const Shade = enum {
    verdigris,
    cinnabar,
};

pub fn unterminated() void {
    const z: Shade = .
}