From 64eaf2f6183d2fd29d52feb4ac0f0888050d2d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 2 May 2026 09:34:44 +0100 Subject: [PATCH] all: fix stray and misplaced doc comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - internal/core/adt: remove orphaned godoc for a non-existent cachedRegexp function above OpContext.regexp. - internal/cuetxtar: move the parseAtPath godoc from above directiveKey, where it was misplaced, to above parseAtPath, joining its tail. - internal/cuetxtar: remove a stray blank line that split the checkErrPositions godoc into two pieces. - pkg/encoding/openapi: replace an empty line in the MarshalSchema godoc example with "//" so the comment block stays attached to the function. Signed-off-by: Daniel Martí Change-Id: I1fbbf525409fb325e019ef39e89debdc31f12c58 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1236528 Unity-Result: CUE porcuepine TryBot-Result: CUEcueckoo Reviewed-by: Matthew Sackman --- internal/core/adt/context.go | 4 ---- internal/cuetxtar/inline_attr.go | 16 ++++++++-------- internal/cuetxtar/inline_err.go | 1 - pkg/encoding/openapi/openapi.go | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/internal/core/adt/context.go b/internal/core/adt/context.go index 4a4ec0fb2..174eb9161 100644 --- a/internal/core/adt/context.go +++ b/internal/core/adt/context.go @@ -1245,10 +1245,6 @@ var regexpCache = newMemoizer(func(pattern string) (*regexp.Regexp, error) { return regexp.Compile(pattern) }) -// cachedRegexp returns a compiled regexp for the given pattern, using a shared -// cache to avoid recompilation and enable thread-safe access. -// - func (c *OpContext) regexp(v Value) *regexp.Regexp { v = Unwrap(v) if isError(v) { diff --git a/internal/cuetxtar/inline_attr.go b/internal/cuetxtar/inline_attr.go index 821d6a14d..9bd5213a2 100644 --- a/internal/cuetxtar/inline_attr.go +++ b/internal/cuetxtar/inline_attr.go @@ -487,14 +487,6 @@ func appendPath(base cue.Path, label ast.Label, hidPkg string) cue.Path { return cue.MakePath(fresh...) } -// parseAtPath parses an at= selector string into a cue.Path. -// Unlike cue.ParsePath, it handles: -// - Hidden field names with a $pkg qualifier, e.g. "_foo$pkg" → -// cue.Hid("_foo", ":pkg"), matching the syntax used inside @test(eq, ...) -// bodies. -// - Integer segments as list-index selectors, e.g. "items.0" → -// [items, Index(0)]. -// // directiveKey returns the deduplication key for a directive. Two directives // with the same name but different at= values are independent assertions and // must both survive deduplication in selectActiveDirectives. @@ -507,6 +499,14 @@ func directiveKey(pa parsedTestAttr) string { return pa.directive } +// parseAtPath parses an at= selector string into a cue.Path. +// Unlike cue.ParsePath, it handles: +// - Hidden field names with a $pkg qualifier, e.g. "_foo$pkg" → +// cue.Hid("_foo", ":pkg"), matching the syntax used inside @test(eq, ...) +// bodies. +// - Integer segments as list-index selectors, e.g. "items.0" → +// [items, Index(0)]. +// // Dotted paths are split on "." and each segment is processed independently, // so "a._foo$pkg.0" works correctly. func parseAtPath(at string) (cue.Path, error) { diff --git a/internal/cuetxtar/inline_err.go b/internal/cuetxtar/inline_err.go index 1aedbb0ce..5d6597d75 100644 --- a/internal/cuetxtar/inline_err.go +++ b/internal/cuetxtar/inline_err.go @@ -945,7 +945,6 @@ func (r *inlineRunner) reportPosMismatch(t testing.TB, path cue.Path, directive } // checkErrPositions verifies that the error positions on val match the pos= - // spec in pa. When positions don't match: // - pos=[] (placeholder): update on CUE_UPDATE=1. // - pos=[non-empty]: update on CUE_UPDATE=force only. diff --git a/pkg/encoding/openapi/openapi.go b/pkg/encoding/openapi/openapi.go index 692ad9e7b..56f865680 100644 --- a/pkg/encoding/openapi/openapi.go +++ b/pkg/encoding/openapi/openapi.go @@ -42,7 +42,7 @@ var ( // // version holds the OpenAPI version to use when marshaling. // // Currently only "3.0.0" is supported. // version!: "3.0.0" // currently "3.0.0" only - +// // // selfContained causes all non-expanded external references // // to be included// // selfContained?: bool -- 2.51.2