Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/path: path.Match is missing in an input parameter #3203

Closed
verdverm opened this issue Jun 6, 2024 · 0 comments
Closed

pkg/path: path.Match is missing in an input parameter #3203

verdverm opened this issue Jun 6, 2024 · 0 comments
Labels
NeedsInvestigation Triage Requires triage/attention

Comments

@verdverm
Copy link

verdverm commented Jun 6, 2024

What version of CUE are you using (cue version)?

0.8.2 & 0.9.0-rc.1

Does this issue reproduce with the latest stable release?

yes, and the RC

What did you do?

https://cuelang.org/play/?id=pJ-fBYTb409#w=function&i=cue&f=eval&o=cue

import "path"

a: path.IsAbs("/foo")
a: path.IsAbs("/foo", "unix")
b: path.Split("/a/b/c")
b: path.Split("/a/b/c", "unix")
c: path.Rel("/a/b/c", "/a/b")
d: path.Match("/a/b/c", "/a")

// Expected way to use
// e1: too many arguments in call to path.Match (have 3, want 2)
// e1: path.Match("foo.cue", "*.cue", "unix")

// so remove os...?
// cannot use "*.cue" as *"unix" | "windows" | "plan9" | "aix" | "android" | ...
// e2: path.Match("foo.cue", "*.cue")

// is this a constraint only?
// error in call to path.Match: runtime error: index out of range [2] with length 2
// e3: "foo.cue" & path.Match("*.cue", "unix")

Additional Context

It appears that there is a missing input parameter during the registration

https://github.com/cue-lang/cue/blob/master/pkg/path/pkg.go#L125

Been this way for 4 years, there are no tests for this function afaict

@verdverm verdverm added NeedsInvestigation Triage Requires triage/attention labels Jun 6, 2024
cueckoo pushed a commit that referenced this issue Jun 6, 2024
The standard library function path.Match requires 3 parameters, but only
2 are currently declared. This causes valid usage of the function to
fail with the following error:

    too many arguments in call to path.Match (have 3, want 2):

To fix this, the missing parameter declaration is added.

Fixes #3203.

Signed-off-by: Noam Dolovich <noam.tzvi.dolovich@gmail.com>
Change-Id: I6e645293f8e589ad1834e3c33ff7bffc2abb5aed
cueckoo pushed a commit that referenced this issue Jun 6, 2024
The standard library function path.Match requires 3 parameters, but only
2 are currently declared. This causes valid usage of the function to
fail with the following error:

    too many arguments in call to path.Match (have 3, want 2):

To fix this, the missing parameter declaration is added.

Fixes #3203.

Signed-off-by: Noam Dolovich <noam.tzvi.dolovich@gmail.com>
Change-Id: I6e645293f8e589ad1834e3c33ff7bffc2abb5aed
@cueckoo cueckoo closed this as completed in e09cb31 Jun 6, 2024
cueckoo pushed a commit that referenced this issue Jun 12, 2024
The standard library function path.Match requires 3 parameters, but only
2 are currently declared. This causes valid usage of the function to
fail with the following error:

    too many arguments in call to path.Match (have 3, want 2):

To fix this, the missing parameter declaration is added.

Fixes #3203.

Signed-off-by: Noam Dolovich <noam.tzvi.dolovich@gmail.com>
Change-Id: I6e645293f8e589ad1834e3c33ff7bffc2abb5aed
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1195888
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1196228
Reviewed-by: Paul Jolly <paul@myitcv.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

1 participant