Now that pipe is a structmap and structmaps are considered indistinguishable to
normal maps, IO redirection should support arbitrary maps too.
Update the relevant section in the language spec and rewrite it a bit.
A year ago I submitted a change to replace AnyError with tests for specific
errors (see https://github.com/elves/elvish/commit/87656c99). This does
something similar for DoesNotCompile. This ensures the test does what
is implied and makes correlating specific unit tests with compilation
errors easier.
This includes a couple of changes to compilation error messages to improve
readability (IMHO) but those are not the primary purpose of this change.
Related #1560
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.
I was surprised to see so many legacy lambda syntax examples in the
documentation. This replaces all of them with the new syntax -- excluding
the handful of cases meant to explicitly verify the legacy form is still
valid. This also adds a link to the issue in the release notes which
documents the change in syntax.
Related #664
- Move from pkg/eval/mods to pkg/mods
- Introduce mods.AddTo that adds all standard library modules
- Move epm and readline-binding into their own packages
Replaces uses of the deprecated builtin `prclose` and `pwclose` commands
with `file close` in unit tests.
This also fixes one test that was not verifying what it intended due to
it's use of `.Throws(AnyError)` which was matching an Elvish error caused
by invalid command `file:prclose $p`.
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.
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.
Using a read-only variable as the target of an `except` clause should
highlight just the var name rather than the entire `try...except...`
statement.
Resolves#1258
When attempting to update a read-only var return an error struct rather
than a simple string (i.e., a Go `error` type). This makes it possible
to include the var name in the error message. This builds on commit
a33ecb2d that highlights the offending var name in the stack trace but
does not include the var name in the error message. With this change the
error message includes the offending var name.
Related #255