Commit Graph

16 Commits

Author SHA1 Message Date
Qi Xiao
51e4d97568 interface{} -> any now that Elvish requires Go 1.18. 2022-03-20 16:17:19 +00:00
Qi Xiao
089752147a Fixup for #1447. 2021-12-13 01:23:14 +00:00
Kurtis Rader
87656c99fa Replace AnyError in tests with a specific error
The `AnyError` placeholder error can cause tests to succeed for errors
other than what was expected. That is, the use of `AnyError` can mask
bugs in a unit test. So replace it with the specific error, or error type,
the test expects to be raised.

This does not remove the anyError structure because it is used in
the TestCase.DoesNotCompile() method. To keep the size of this change
as small as possible I want to defer updating that use to a separate
change. However, remove the public AnyError var so future test writers
don't attempt to use it.
2021-12-13 01:08:24 +00:00
Qi Xiao
68168da9fc pkg/eval: Convert elements of slice return value from a GoFn to individual outputs. 2021-10-03 16:34:52 +01:00
Qi Xiao
657b73122f Change all builtin commands writing value output to surface ReaderGone.
Also replace (*Frame).OutputChan with (*Frame).ValueOutput, which returns a
small interface for writing to the value output that is also aware when the
reader is gone.
2021-06-18 00:14:59 +01:00
Kurtis Rader
9a576529a3 Replace ErrArgs with more specific errors
This also replaces the slightly awkward "arguments here" reason with
"argument count" as the "what" for a typical errs.ArityMismatch
exception. It also reformats most of the constructors so that the "what"
is on the same line. This makes `grep errs.ArityMismatch **.go` more
useful as a result.
2021-06-13 22:42:04 +01:00
Kurtis Rader
9345125bd2 staticcheck lint cleanups
Fix two issues found by `staticcheck -tests=false ./...`:

pkg/eval/go_fn.go:155:5: var errNoOptions is unused (U1000)
pkg/persistent/hashmap/hashmap.go:321:2: only the first constant in this group has an explicit type (SA9004)
2021-06-06 14:54:47 +01:00
Qi Xiao
91b6f6dd72 Use the integrated persistent package. 2021-05-03 22:17:46 +01:00
Qi Xiao
2ac9d891ca Improve readability of argument mismatch error message.
* Use 0-based indexing.

* Use more natural-sounding English.

Inspired by #1290.
2021-05-02 00:27:38 +01:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Qi Xiao
5c55e72e78 pkg/eval: Update comments about the Elvish-Go interface. 2021-01-05 05:23:28 +00:00
Shengjing Zhu
6c08de0ff3 Fix typos found by codespell 2020-10-10 22:47:50 +01:00
Qi Xiao
948432e766 pkg/eval: De-export GoFn. 2020-09-04 22:30:42 +01:00
Qi Xiao
e72f7183a0 pkg/eval/go_fn.go: Surface errors in option parsing.
This fixes #958.
2020-05-03 23:39:16 +01:00
Qi Xiao
07a9e781a6 pkg/eval: Report detailed ArityMismatch errors. 2020-04-13 00:47:33 +01:00
Qi Xiao
e45fdf7228 Move all libraries to new pkg/. 2019-12-23 20:00:59 +00:00