Commit Graph

5703 Commits

Author SHA1 Message Date
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
95baad069e Document the new "tmp" special command. 2021-12-11 12:14:45 +00:00
Qi Xiao
da66d3cdc1 Publish 0.17.0. 2021-12-10 17:40:28 +00:00
Qi Xiao
973fe39798 Implement the tmp special command.
This addresses #1114.
2021-12-09 22:12:38 +00:00
Qi Xiao
c1adf58b6d Document using "range n | each" to execute something n times.
This addresses #1433.
2021-12-08 00:32:32 +00:00
Qi Xiao
8cbd39f006 Support calling edit:notify with a styled text.
This fixes #1438.
2021-12-08 00:26:17 +00:00
Qi Xiao
2941f5308e Fix deprecated code in epm. 2021-12-07 00:44:28 +00:00
Qi Xiao
0cef608fe6 Document that "range" now supports counting down in the 0.17.0 release notes. 2021-12-07 00:33:22 +00:00
Harald Hanche-Olsen
fe8af31f2d Fix deprecated code in readline-bindings 2021-12-07 00:30:33 +00:00
Qi Xiao
cf390553bf Upgrade dependencies. 2021-12-06 00:37:48 +00:00
Qi Xiao
6a9931e662 Bump version and deprecation level
Now that v0.17-release has been branched, the HEAD build will show deprecations
intended for 0.17.0, and be considered a pre-release version of 0.18.0.
2021-12-06 00:30:36 +00:00
Qi Xiao
14a81d12f8 pkg/eval: Initialize ns variables to an empty ns, rather than nil.
This fixes #1257.
2021-12-06 00:18:09 +00:00
Qi Xiao
ab88de7c15 Fix ScanToGo's error message when ptr points to an interface.
When the destination to scan into is an interface, its zero value is simply a
nil interface, losing the information of the original type and resulting in
error messages like "need nil, got $actual-type".

ScanToGo now handles this case specifically, and uses the string representation
of the interface type in the error message.

Before:

~> ns []
Exception: wrong type of argument 0: wrong type: need nil, got list
~> var x~ = x
Exception: wrong type: need nil, got string

After:

~> ns []
Exception: wrong type of argument 0: wrong type: need !!hashmap.Map, got list
~> var x~ = x
Exception: wrong type: need !!eval.Callable, got string

This is still not ideal, since the "need" type is not given as an Elvish "kind",
but it's much less confusing than than old "need nil" messages.

This fixes #715.
2021-12-05 23:49:49 +00:00
Qi Xiao
82dda13def Fixup for #1435. 2021-12-05 20:51:17 +00:00
Qi Xiao
0bbae88544
Merge pull request #1435 from krader1961/add-compare-builtin
Add a builtin:compare command
2021-12-05 20:38:30 +00:00
Qi Xiao
713a16bc6e
Merge branch 'master' into add-compare-builtin 2021-12-05 20:37:13 +00:00
Qi Xiao
b1154a95dc Fixup for #1439.
* Fix the case when start is near the overflow point and add regression tests.

* Rewrite the implementation in a less abstract way.

* Rewrite the elvdoc.
2021-12-05 20:22:44 +00:00
Kurtis Rader
2ba69c32dd Augment builtin:range to support counting down
Resolves #1436
2021-12-05 18:44:59 +00:00
Qi Xiao
6bb91a5312 Document performance improvement. 2021-12-02 00:49:36 +00:00
Qi Xiao
64661d6b33 pkg/eval: Execute the last form in a pipeline on the current goroutine.
This simple optimization improves the performance of pipelines containing only
one form drastically. Pipelines containing more than one form also execute a
little bit faster.

A subset of the benchmark results, on MacBook Air M1 2020:

| Benchmark | Before      | After       | Speedup |
| --------- | ----------- | ----------- | ------- |
| nop       |  3398 ns/op | 934.1 ns/op | 3.6x    |
| nop-nop   | 13596 ns/op | 11423 ns/op | 1.2x    |
| put-x     |  4163 ns/op |  1611 ns/op | 2.6x    |
2021-12-02 00:34:36 +00:00
Qi Xiao
9e6555a4fb pkg/eval: Reorganize benchmarks.
Use b.Run to run benchmarks. Also remove the dedicated tests for output capture.
2021-12-02 00:30:01 +00:00
Qi Xiao
9dfda4c753 Use onclick="" to make :hover work on mobile.
Anchor link will be shown after clicking the header. Not sure how this works,
but it does work. Seen on https://stackoverflow.com/a/25673064/566659.
2021-11-30 01:45:53 +00:00
Qi Xiao
090c8ccf82 Tweak styling of header anchors.
* Use normal text color.

* Add a small padding-left.

* Also show when parent is :active, for mobile friendliness.
2021-11-30 01:36:09 +00:00
Qi Xiao
50b0db0a59 website: Add anchor link for each header.
This fixes #1426.
2021-11-30 01:14:02 +00:00
Qi Xiao
246706aeca website: Preserve ":" in elvdoc header IDs.
This fixes #1430.
2021-11-29 23:47:59 +00:00
Qi Xiao
477319c9de Merge branch 'check-rellinks' 2021-11-29 21:30:35 +00:00
Qi Xiao
16164f413f Disable CGo in check-rellinks. 2021-11-29 21:28:34 +00:00
Qi Xiao
f3dd676ead Try running check-rellinks as root 2021-11-29 21:26:41 +00:00
Qi Xiao
e9b3a4c800 Add missing sudo 2021-11-29 21:18:47 +00:00
Qi Xiao
113c4dee9c Fix permission of /go in check-rellinks 2021-11-29 21:17:35 +00:00
Qi Xiao
d94779da33 Try workaround of specifying "--user 1001" in check-rellinks.
https://github.com/actions/checkout/issues/211#issuecomment-680107607
2021-11-29 20:55:12 +00:00
Qi Xiao
22981175db Inspect the content of github workspace 2021-11-29 20:51:42 +00:00
Qi Xiao
383e2bf718 Try to fix workspace setup in check-rellinks 2021-11-29 20:47:20 +00:00
Qi Xiao
e060a6842a Use "shell: sh" to the check-rellinks step. 2021-11-29 20:44:03 +00:00
Qi Xiao
9bebf437ff Set up workspace dir in check-rellinks 2021-11-29 20:40:26 +00:00
Qi Xiao
697f038d3d Try using the elves/up image for check-rellinks. 2021-11-29 20:23:30 +00:00
Qi Xiao
9f3204966d Add a missing sudo when installing pandoc 2021-11-29 20:17:47 +00:00
Qi Xiao
927a4fff1e Install pandoc in the check-rellinks workflow. 2021-11-29 20:15:00 +00:00
Qi Xiao
ce7c4e5095 Add step to set up Go when checking relative links.
The workflow requires building the website, which requires an up-to-date version of Go.
2021-11-29 20:09:56 +00:00
Qi Xiao
4578732c9c Check relative links as part of the CI. 2021-11-29 20:06:12 +00:00
Qi Xiao
a0b93968a3 Fix broken relative links. 2021-11-29 20:03:09 +00:00
Qi Xiao
27421a0c25 Handle module names with "-" in ref-deps. 2021-11-29 20:02:26 +00:00
Qi Xiao
b342163e4e website: Add Python script to check relative links. 2021-11-29 19:59:26 +00:00
Qi Xiao
7f820c0ff1 website: Rewrite Makefile.
* Reorder the targets to be top-down

* Make the tool binaries individual real targets, rather than a phony target

* Use .SECONDEXPANSION to determine dependencies of tool binaries and HTML outputs precisely
2021-11-29 15:32:13 +00:00
Qi Xiao
f6e0bc1855 Fix typo and broken link in language.md 2021-11-29 11:23:10 +00:00
Qi Xiao
b05fc3250c Fixup for #1440.
- Fix whitespace inconsistency

- Fix comment in parse/parse.go
2021-11-28 21:32:41 +00:00
Kurtis Rader
d4b4edbbbe Replace legacy lambda with new lambda examples
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
2021-11-28 21:30:59 +00:00
Qi Xiao
08c5f512bf Apply more tweaks to the path module's elvdoc. 2021-11-28 21:14:43 +00:00
Kurtis Rader
bf04fae352 Improve the path: module documentation
This change is due to a recent IM discussion wherein someone had
difficulty finding the `path:is-regular` command. It attempts to make
such discovery easier.
2021-11-28 21:13:46 +00:00
Qi Xiao
6ea9753769 website: Update documentation for numbers.
* Note that the "010" syntax for octal numbers is subject to change.

* Fix typo "separately" -> "separated".

* Add an additional example for use of underscores.
2021-11-23 23:25:36 +00:00