this repo has no description
0
fork

Configure Feed

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

internal/cuetxtar: fix error message formatting

- astcmp: fix backwards error in cmpDisjunction: the error "value is a
disjunction but expected expression is not" had the subject wrong;
it fires when the *expected* expression is a disjunction but the
value is not. Reword to make the cause and fix self-evident.

- inline_err: show absolute line number in position mismatch message.
Relative specs (e.g. -4:7) are resolved to the absolute line before
printing so the reader can compare "unmatched position 14:7" directly
against "actual: 18:7" without doing arithmetic. The raw spec is
still shown in parentheses for reference.

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I4826769346ea409de2c23eb602769ba97d4c609a
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1235352
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+3 -3
+2 -2
internal/cuetxtar/astcmp.go
··· 773 773 tv := val.Core() 774 774 dj, ok := tv.V.DerefValue().BaseValue.(*adt.Disjunction) 775 775 if !ok { 776 - return pathErr(path, "value is a disjunction but expected expression is not; "+ 777 - "use a disjunction in the expected value or @test(final) on the field") 776 + return pathErr(path, "expected expression is a disjunction but value is not; "+ 777 + "wrap the expected value in a struct or use at= to target a sub-field") 778 778 } 779 779 780 780 // Match value disjuncts to AST disjuncts order-independently.
+1 -1
internal/cuetxtar/inline_err.go
··· 751 751 if exp.fileName != "" { 752 752 t.Errorf("path %s: %s: unmatched position %s:%d:%d; actual positions:", path, directive, exp.fileName, exp.absLine, exp.col) 753 753 } else { 754 - t.Errorf("path %s: %s: unmatched position %d:%d; actual positions:", path, directive, exp.deltaLine, exp.col) 754 + t.Errorf("path %s: %s: unmatched position %d:%d (spec %d:%d); actual positions:", path, directive, baseLine+exp.deltaLine, exp.col, exp.deltaLine, exp.col) 755 755 } 756 756 for _, p := range positions { 757 757 t.Logf(" actual: %d:%d", p.Line(), p.Column())