this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

lsp/eval: add test to show bad behaviour of aliases

The current evaluation of `a: L={b: _, c: L.b}` is faulty: paths that
start with `a` will not resolve correctly. E.g. `a.b` does not resolve
to the `b` field within the inner struct.

Signed-off-by: Matthew Sackman <matthew@cue.works>
Change-Id: I73da6a64ed391172d3e9989a207c62b908231a42
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1231153
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+14 -8
+14 -8
internal/lsp/eval/eval_test.go
··· 2171 2171 name: "Alias_Expr_External", 2172 2172 archive: `-- a.cue -- 2173 2173 a: l={b: 3} 2174 - c: l.b`, 2174 + c: l.b 2175 + d: a.b`, 2175 2176 // This type of alias is only visible within the value. 2176 2177 expectDefinitions: map[position][]position{ 2177 2178 ln(2, 1, "l"): {}, 2178 2179 ln(2, 1, "b"): {}, 2180 + ln(3, 1, "a"): {ln(1, 1, "a")}, 2181 + ln(3, 1, "b"): {}, // This is WRONG it should be {ln(1, 1, "b")}, 2179 2182 2180 2183 ln(1, 1, "a"): {self}, 2181 2184 ln(1, 1, "l"): {self}, 2182 2185 ln(1, 1, "b"): {self}, 2183 2186 2184 2187 ln(2, 1, "c"): {self}, 2188 + ln(3, 1, "d"): {self}, 2185 2189 }, 2186 2190 expectCompletions: map[offsetRange]fieldEmbedCompletions{ 2187 - or(0, 2): {f: []string{"a", "c"}}, 2188 - or1(2): {e: []string{"a", "c"}}, 2189 - or1(5): {f: []string{"b"}, e: []string{"a", "c", "l"}}, 2191 + or(0, 2): {f: []string{"a", "c", "d"}}, 2192 + or1(2): {e: []string{"a", "c", "d"}}, 2193 + or1(5): {f: []string{"b"}, e: []string{"a", "c", "d", "l"}}, 2190 2194 or(6, 8): {f: []string{"b"}}, 2191 - or1(8): {e: []string{"a", "b", "c", "l"}}, 2192 - or1(10): {e: []string{"a", "b", "c", "l"}}, 2193 - or(12, 14): {f: []string{"a", "c"}}, 2194 - or(14, 17): {e: []string{"a", "c"}}, 2195 + or1(8): {e: []string{"a", "b", "c", "d", "l"}}, 2196 + or1(10): {e: []string{"a", "b", "c", "d", "l"}}, 2197 + or(12, 14): {f: []string{"a", "c", "d"}}, 2198 + or(14, 17): {e: []string{"a", "c", "d"}}, 2199 + or(19, 21): {f: []string{"a", "c", "d"}}, 2200 + or(21, 24): {e: []string{"a", "c", "d"}}, 2195 2201 }, 2196 2202 }, 2197 2203