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 showing bad behaviour

{d: _} & {e: d}

Here, the path `d` is resolving to the field `d`, but only when this
occurs at the package level. E.g.

s: {{d: _} & {e: d}}

doesn't exhibit the same bad behaviour.

This points to resolution of fields at the package-level being faulty.

Issue #4284

Signed-off-by: Matthew Sackman <matthew@cue.works>
Change-Id: Ie4cb8351ba2b4eadede8d88d3078730e14260871
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1232478
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>

+79
+79
internal/lsp/eval/eval_test.go
··· 3372 3372 }, 3373 3373 3374 3374 { 3375 + name: "Package_Level_Scopes", 3376 + archive: `-- a.cue -- 3377 + x: { 3378 + {b: _} & {c: b} 3379 + b: _ 3380 + } 3381 + 3382 + y: { 3383 + {b: _} & {c: b} 3384 + } 3385 + 3386 + {d: _} & {e: d} 3387 + 3388 + {g: _} & {h: g} 3389 + g: _ 3390 + `, 3391 + expectDefinitions: map[position][]position{ 3392 + ln(2, 2, "b"): {ln(2, 1, "b"), ln(3, 1, "b")}, 3393 + ln(10, 2, "d"): {ln(10, 1, "d")}, // this is WRONG. Should not resolve at all. 3394 + ln(12, 2, "g"): {ln(12, 1, "g"), ln(13, 1, "g")}, 3395 + 3396 + ln(1, 1, "x"): {self}, 3397 + ln(2, 1, "c"): {self}, 3398 + ln(2, 1, "b"): {self, ln(3, 1, "b")}, 3399 + ln(3, 1, "b"): {self, ln(2, 1, "b")}, 3400 + 3401 + ln(6, 1, "y"): {self}, 3402 + 3403 + ln(7, 1, "b"): {self}, 3404 + ln(7, 1, "c"): {self}, 3405 + 3406 + ln(10, 1, "d"): {self}, 3407 + ln(10, 1, "e"): {self}, 3408 + 3409 + ln(12, 1, "g"): {self, ln(13, 1, "g")}, 3410 + ln(12, 1, "h"): {self}, 3411 + ln(13, 1, "g"): {self, ln(12, 1, "g")}, 3412 + }, 3413 + expectCompletions: map[offsetRange]fieldEmbedCompletions{ 3414 + or(0, 2): {f: []string{"d", "e", "g", "h", "x", "y"}}, 3415 + or(2, 6): {f: []string{"b", "c"}, e: []string{"g", "x", "y"}}, 3416 + or1(6): {f: []string{"b", "c"}, e: []string{"b", "g", "x", "y"}}, 3417 + or(7, 9): {f: []string{"b", "c"}}, 3418 + or(9, 12): {e: []string{"b", "g", "x", "y"}}, 3419 + or1(15): {f: []string{"b", "c"}, e: []string{"b", "g", "x", "y"}}, 3420 + or(16, 18): {f: []string{"b", "c"}}, 3421 + or(18, 21): {e: []string{"b", "c", "g", "x", "y"}}, 3422 + or1(22): {f: []string{"b", "c"}, e: []string{"g", "x", "y"}}, 3423 + or(23, 25): {f: []string{"b", "c"}}, 3424 + or(25, 28): {e: []string{"b", "g", "x", "y"}}, 3425 + or1(28): {f: []string{"b", "c"}, e: []string{"g", "x", "y"}}, 3426 + or(30, 33): {f: []string{"d", "e", "g", "h", "x", "y"}}, 3427 + or(33, 38): {f: []string{"b", "c"}, e: []string{"g", "x", "y"}}, 3428 + or(38, 40): {f: []string{"b", "c"}}, 3429 + or(40, 43): {e: []string{"b", "g", "x", "y"}}, 3430 + or1(46): {f: []string{"b", "c"}, e: []string{"g", "x", "y"}}, 3431 + or(47, 49): {f: []string{"b", "c"}}, 3432 + or(49, 52): {e: []string{"c", "g", "x", "y"}}, 3433 + or1(53): {f: []string{"b", "c"}, e: []string{"g", "x", "y"}}, 3434 + or1(55): {f: []string{"d", "e", "g", "h", "x", "y"}}, 3435 + or1(56): {f: []string{"d", "e", "g", "h", "x", "y"}, e: []string{"g", "x", "y"}}, 3436 + or(57, 59): {f: []string{"d", "e", "g", "h", "x", "y"}}, 3437 + or(59, 62): {e: []string{"d", "g", "x", "y"}}, 3438 + or1(65): {f: []string{"d", "e", "g", "h", "x", "y"}, e: []string{"g", "x", "y"}}, 3439 + or(66, 68): {f: []string{"d", "e", "g", "h", "x", "y"}}, 3440 + or(68, 71): {e: []string{"e", "g", "x", "y"}}, 3441 + or1(72): {f: []string{"d", "e", "g", "h", "x", "y"}}, 3442 + or1(73): {f: []string{"d", "e", "g", "h", "x", "y"}, e: []string{"g", "x", "y"}}, 3443 + or(74, 76): {f: []string{"d", "e", "g", "h", "x", "y"}}, 3444 + or(76, 79): {e: []string{"g", "x", "y"}}, 3445 + or1(82): {f: []string{"d", "e", "g", "h", "x", "y"}, e: []string{"g", "x", "y"}}, 3446 + or(83, 85): {f: []string{"d", "e", "g", "h", "x", "y"}}, 3447 + or(85, 88): {e: []string{"g", "h", "x", "y"}}, 3448 + or(89, 91): {f: []string{"d", "e", "g", "h", "x", "y"}}, 3449 + or(91, 94): {e: []string{"g", "x", "y"}}, 3450 + }, 3451 + }, 3452 + 3453 + { 3375 3454 name: "MultiFile_Package_Top_Single", 3376 3455 archive: `-- a.cue -- 3377 3456 package x