1
1
mirror of https://github.com/tweag/nickel.git synced 2024-10-05 23:57:09 +03:00
Commit Graph

3985 Commits

Author SHA1 Message Date
Yann Hamdaoui
4e3a030b5b
Add discord link to READMEs (#1742) 2023-12-20 09:30:58 +00:00
Yann Hamdaoui
d35baaee1c
Add --error-format flag to serialize err diagnostics (#1740)
* Add --error-format flag to serialize err diagnostics

* Make other CLI errors follow --error-format as well
2023-12-19 15:36:57 +00:00
Michał Kukieła
44ac62f938
Fix swapped links in "Turing completeness" section (#1741) 2023-12-19 04:06:09 +00:00
dependabot[bot]
e1113af368
chore(deps): bump zerocopy from 0.7.18 to 0.7.31 (#1739)
Bumps [zerocopy](https://github.com/google/zerocopy) from 0.7.18 to 0.7.31.
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.7.18...v0.7.31)

---
updated-dependencies:
- dependency-name: zerocopy
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-15 12:59:12 +00:00
silverraven691
2819b4b28a
Fix typo in doc/manual/syntax.md (#1737)
* Fix typo in doc/manual/syntax.md

* Update doc/manual/syntax.md

---------

Co-authored-by: jneem <joeneeman@gmail.com>
2023-12-07 22:53:33 +00:00
Quantum64
7fe5946a61
Support importing txt files as strings (#1734)
* Support importing txt files as strings

* Change String to Raw
2023-12-05 08:43:27 +00:00
jneem
b55626bc20
Add kcl comparison (#1730)
* Add kcl comparison

* Extend the blurb and add it to the tables

* Update README.md

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>

* Update README.md

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>

* Update RATIONALE.md

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-12-04 10:59:01 +00:00
Yann Hamdaoui
5c4298f685
Print something when nickel doc succeeds (#1729)
The doc subcommand has been reported to be a bit confusing, because it
generates file in a default location but just returns without further
details upon success. This commits add a print statement that says where
the document has been generated instead.
2023-12-01 10:05:15 +00:00
Yann Hamdaoui
b52687760a
Update Nickel IM channel from Matrix to Discord (#1728) 2023-11-29 18:09:34 +00:00
jneem
2c8cdfc1c4
Fix hover on assignments to subrecords (#1725) 2023-11-29 17:42:13 +00:00
dependabot[bot]
f4f866f960
chore(deps): bump cachix/cachix-action from 12 to 13 (#1727)
Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 12 to 13.
- [Release notes](https://github.com/cachix/cachix-action/releases)
- [Commits](https://github.com/cachix/cachix-action/compare/v12...v13)

---
updated-dependencies:
- dependency-name: cachix/cachix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-29 09:10:48 +00:00
dependabot[bot]
f0cf3967b8
chore(deps): bump cachix/install-nix-action from 23 to 24 (#1726)
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 23 to 24.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v23...v24)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-29 09:10:24 +00:00
jneem
a6dca6ad8f
Add a cli param to specify the search path (#1721)
* Add a cli param to specify the search path

* Change the names around
2023-11-28 15:09:57 +00:00
Viktor Kleen
761f6f425a
release infrastructure: disable nodejs16 support for the GitHub runner (#1724)
The nixpkgs derivation for the GitHub runner has removed support for
nodejs16 and with recent versions that support isn't needed anymore.
2023-11-28 13:45:33 +00:00
jneem
f7ffe31697
Search for imports in NICKEL_PATH (#1716)
* Search for imports in NICKEL_PATH

* Move the env variable part to the cli

* Add a test

* Add a failing test
2023-11-22 16:56:58 +00:00
jneem
95d952fb65
Bump flake lock (manually) (#1720)
* Bump flake lock (manually)

* clippy
2023-11-21 15:33:27 +00:00
Yann Hamdaoui
8d7725da77
Fix flake commands for 1.3.0 new CLI (#1715) 2023-11-16 18:10:55 +00:00
Yann Hamdaoui
22e94cff46
1.3.0 release (#1714)
* Bump version numbers for 1.3 release

* Add release notes (part 1)

* Bump latest version mentioned in READMEs to 1.3

* Bump latest version mentioned in manual to 1.3

* Update RELEASING guide
2023-11-16 17:52:59 +00:00
Yann Hamdaoui
eda326f92b
Add a --field argument to subcommands whenever it makes sense (#1712)
* Factor out extract_field() from query()

* Add selectable field to Program

* Add --field to supported commands

This commit finishes the series on adding `--field` argument to the CLI.
This argument is factorized as a new Customize implementer which
regroups commands that don't support general customization (overriding)
but still support selecting a specific field from the configuration.
It's added to the full customization as well.

In consequence, commands that didn't support selecting particular field
before now generically support the `--field` argument. The `--path`
argument for `--query` is removed and is just a `--field` argument for
`nickel query`.

* Fix not taking the --field into account when not customizing

* Formatting

* Fix tests for new --field argument

* Fix clippy warning

* Fix compilation errors, tests, and improve error messages

* Avoid duplicating 'field' declaration in clap
2023-11-16 11:37:54 +00:00
Yann Hamdaoui
f186e0e169
New syntax for customize mode (#1709)
* Customize mode new assignment syntax, part 1

* Add StaticPathField parsing rule

* Add cli assignment parsing rule

* Use new assignment parsing rule, refactor common code

* Fix compilation warnings

* Improve the output of `-- list` including type and contracts

* Remove unused datatype

* Formatting

* Fix old tests and add new for customize mode

* Reword documentation of FieldInterface::is_input

* Pass on code documentation

* Remove obsolete comment

* Update cli/tests/snapshot/inputs/customize-mode/unknown_override.ncl

Co-authored-by: jneem <joeneeman@gmail.com>

* Update cli/tests/snapshot/inputs/customize-mode/unkonwn_field_path.ncl

Co-authored-by: jneem <joeneeman@gmail.com>

* Update cli/src/customize/interface.rs

Co-authored-by: jneem <joeneeman@gmail.com>

* Fix typos in snapshot tests

* Add suggestion for customize mode unknown field errors

* Update snapshot tests with new output

* Get rid of '-- show', hint at using query instead

---------

Co-authored-by: jneem <joeneeman@gmail.com>
2023-11-16 10:26:39 +00:00
Yann Hamdaoui
c0729415e4
Add suggestions when misspelling a record field (#1710)
* Add strsim dependency

* Move error module into its own directory

* Add error::suggest module and fn to find best suggestion

* Add field_names() method to RecordData

* Make find_match more generic

* Add conversion identifier/nickel string

* Add suggestion to missing field errors

* Fix tests and rename item

* Add snapshot test for field suggestion

* Remove debug println and fix code comment

* Review suggestion: improve missing field error message

* Formatting
2023-11-13 17:17:35 +00:00
Yann Hamdaoui
28672ee45b
Update malachite 3.x -> 4.x (and other crates) (#1705) 2023-10-30 09:03:50 +00:00
Yann Hamdaoui
11c8fab020
Fix unsound contract equality fast check (#1703)
* Fix unsound ptr eq check in contract equality

For performance reason, the contract equality checker performs a quick
pointer check to see if the two terms to compare are physically equal.
In this case, it used to return `true` directly, eschewing more costly
recursive checks.

However, this is unsound, because the same term (physically) might be in two
different environments, and have two different values. This is typically
the case with function application: when evaluating `f 1` and `f 2`,
both terms will physically point to the body of `f`, but in a different
environment. Thus, we also need to ensure that environment are equals as
well in this quick check.

This commit adds a fast `ptr_eq` check to the environment as well, and
now checks that both terms and their respective environments are
pairwise physically equals.

Passing by, this commits also fix unrelated clippy warning, after the
udpate to clippy 1.73.

* Add regression test for #1700

* Implement env equality during typechecking

* Cosmetic renaming and slight rework of comments

* Fix contract test by deeply evaluating it

* Remove confusing comments
2023-10-29 12:21:14 +00:00
Yann Hamdaoui
1921c316ad
Fix contract equality on revertible thunks (#1699)
* Fix contract equality for unevaluated recursive records

The previous code failed when trying to check contracts for equality,
when those contracts had been reverted as part of merging (i.e. when
they recursively depend of other fields of the record), when they are
back to a function form.

To do so, we rely on the already existing behavior that contract
equality consider terms to be open, and that unbound variables are
tested for syntactic equality. Doing so, this commit also simplifies a
lot the previous machinery: we can apply the same idea to the initial
environment, and don't need to thread it through contract equality
checks anymore.

* Cleanup and formatting

* Get rid of NoEnvironment; use empty env instead

* Remove useless explicit instantiations

* Remove debug println

* More explicit names for borrow_ and closure_, improve doc
2023-10-26 14:51:42 +00:00
Yann Hamdaoui
5b7d59af24
Use match_shared in the main eval loop (#1698)
* Update documentation of eval module

* Use shared_term in eval, return Closure instead of tuple

* Clippy warnings

* Remove old pre-matched_shared! code which caused bad performance

* Formatting

* Remove additional clones

* Remove useless clone

* Get rid of more clones
2023-10-25 21:03:02 +00:00
jneem
f0de135af5
Improve hover output for let patterns (#1696)
* Improve hover output for let patterns

* Be a little less eager to combine

* Less clones
2023-10-24 23:40:05 +00:00
Giorgio Gallo
75107c1421
Reword impl of partial_cmp for Ident, LocIdent (#1697)
This rewords the implementation of partial_cmp for Ident and LocalIdent in a way that pleases clippy.

Note that the implementation was correct and that this does not change its behaviour.
2023-10-24 20:04:44 +00:00
Taeer Bar-Yam
fe66a02bde
change nickel-nix to organist (#1691)
* change nickel-nix to organist

* Update README.md

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-10-20 10:09:34 +00:00
Björn Nilsson
933945d761
Fix doc, example code for pipe lacks prefix (#1692)
The example code for "pipe" doesn't compile because the method "pipe" lacks prefix. Fixed by changing "pipe" to "std.function.pipe"
2023-10-20 09:44:43 +00:00
Björn Nilsson
d61145b15b
Fix invalid example code in doc of blame_with_message (#1689)
Fix wrong method name: "std.contract.blame_with_message_message"
should be: "std.contract.blame_with_message"
2023-10-19 14:28:29 +00:00
dependabot[bot]
cde6290b08
chore(deps): bump rustix from 0.37.23 to 0.37.25 (#1688)
Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.37.23 to 0.37.25.
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.37.23...v0.37.25)

---
updated-dependencies:
- dependency-name: rustix
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-19 09:54:03 +00:00
Yann Hamdaoui
2a727baaea
Get rid of most generated variables (#1679)
* add Closure node to AST

* Implement non-looping partial eq for Term

* Fix contracts app

* Use closure within records as well everywhere

* Fix double closurization

* Fix subst to update closurized attrs

* Fix type eq for closures

* More typecheck eq

* More work + formatting

* Get rid of share normal form + move Closurize to dedicated mod

* Accept new snapshots (error msg less noisy)

* Fix compilation warnings

* Fix various small TODOs left

* Cleaning comments and debug println

* Update documentation for new closurize approach

* Apply suggestions from code review

Co-authored-by: jneem <joeneeman@gmail.com>

* Update core/src/closurize.rs

Co-authored-by: jneem <joeneeman@gmail.com>

* Fix various code comments

* Post-rebase fixup

* Formatting + post-rebase fixup

* Restore array contract dedup fix messed up by rebases

---------

Co-authored-by: jneem <joeneeman@gmail.com>
2023-10-16 11:57:30 +00:00
Taeer Bar-Yam
859293a3e5
Make rustfmt work in match_sharedterm! (#1677)
* Make rustfmt work in match_sharedterm!

macros can have syntax that rustfmt doens't know how to deal with, so it
only triggers on macros that
1. are called with `()` or `[]` delimiters (not `{}`)
2. contain only valid rust syntax

our match_sharedterm! failed on both those counts, so this commit fixes
that. we move the `else` clause back inside the match statement as a
wildcard arm, and use the `match` keyword so that rustfmt understands
how we want the code formatted

* Update core/src/term/mod.rs

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-10-13 16:46:12 +00:00
Yann Hamdaoui
7e4ecd908c
Fix array closurization just forgetting common contracts (#1678)
* Fix array closurization just forgetting common contracts

* Reduce the number of iterator combinators
2023-10-13 15:23:22 +00:00
jneem
97e18afffb
Add cousin search to goto and hover (#1670)
* Add cousin search to goto and hover

* Code review comments
2023-10-12 21:51:34 +00:00
jneem
4dfd59a38c
First prototype of evaluation (#1672)
* First prototype of code action eval

* Update comment
2023-10-12 17:35:52 +00:00
Yann Hamdaoui
3edcb52ebb
Get rid of shallow_repr and print full terms (#1676) 2023-10-12 16:58:23 +00:00
Yann Hamdaoui
47823f582b
Array contract deduplication (#1674)
* Contract deduplication for arrays as well

* Fix reverted boolean check

* Fix other boolean error + clippy warning
2023-10-12 07:54:51 +00:00
Yann Hamdaoui
a3505a1e02
Print pretty diagnostic when a benchmark fails (#1675) 2023-10-11 16:29:59 +00:00
Yann Hamdaoui
f3ce8f3fab
Avoid quadratic behavior when optimizing contracts (#1673)
* Avoid quadratic behavior when optimizing contracts

* Formatting
2023-10-11 09:02:23 +00:00
Yann Hamdaoui
a80c20d115
Contract elision for static types (#1671)
* Extend record_op_kind to insertion and deletion

* Fix compilation errors

* Add specialized builtin contracts

* First take at optimizing static contracts

* Optimizing static contracts, second take

* More documentation

* Do not use has_field_all now that record_insert is fixed

* Apply suggestions from code review

Co-authored-by: jneem <joeneeman@gmail.com>

* Fix clippy warning

* Fix cargo doc warning

* Fix manual snippets check

---------

Co-authored-by: jneem <joeneeman@gmail.com>
2023-10-10 10:23:05 +00:00
Yann Hamdaoui
94c25735d4
Fix record.update by making record.insert act consistently (#1669)
* Add variant of has_field that considers non-empty opt ones

* Extend record_op_kind to insertion and deletion

* Fix compilation errors

* Add regression test

* Pretty-printing of record operator variants

* Formatting

* Update core/src/term/mod.rs

Co-authored-by: jneem <joeneeman@gmail.com>

---------

Co-authored-by: jneem <joeneeman@gmail.com>
2023-10-10 07:38:26 +00:00
Taeer Bar-Yam
91d63ed611
add %eval_nix% primop (#1465)
* add importing nix files behind a nix-experimental feature flag

* add %eval_nix% builtin to evaluate a nix string

* basic error reporting from nix

* error messages

* use pkg-config to find nix dependency

* nice error message when feature disabled

* better errors

* resolve XXX

* put appropriate dependencies in nativeBuildInputs

* explain -sys crate option

* no %% around builtins in error messages

* clippy needs nativeBuildInputs

* clippy

* fix cargo doc

* use nix master

* c++17 -> c++20

* cargo fmt

* review comments

* fixup after merge

* fix after rebase

* revert to (hopefully) known good nix commit

* try using nix's own nixpkgs

* this worked on build02

* debug for mac CI

* debug doesn't work

* cargo fmt

* debug

* don't fail everything if we can't debug

* debug take N

* nix-version

* remove debug

* disable checks for nix on x86_64-darwin
2023-10-09 15:08:55 +00:00
jneem
8eae2c70fd
Add goto support for pattern bindings (#1665)
* Add goto support for pattern bindings

* Fix compilation after rebase
2023-10-05 00:59:11 +00:00
jneem
cc8f4e012f
Take the ancestor path into account when env-completing from uncles. (#1661)
* Track paths in the parent chain

* Don't offer the completion at the cursor

* Fix rebase issues

* Improve parent iter

* Fix docs
2023-10-05 00:05:03 +00:00
jneem
09e51fba6a
Remove/rename the Linearizer trait (#1663)
* Remove/rename the Linearizer trait

* TypeVisitor -> TypecheckVisitor
2023-10-03 22:04:23 +00:00
jneem
221215e48d
Add nls benchmarks (#1659) 2023-10-03 21:31:40 +00:00
Yann Hamdaoui
d904cc55d3
flake.lock: Update (#1662)
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/e35dcc04a3853da485a396bdd332217d0ac9054f' (2023-09-22)
  → 'github:NixOS/nixpkgs/8a86b98f0ba1c405358f1b71ff8b5e1d317f5db2' (2023-09-27)
• Updated input 'pre-commit-hooks':
    'github:cachix/pre-commit-hooks.nix/4f883a76282bc28eb952570afc3d8a1bf6f481d7' (2023-09-10)
  → 'github:cachix/pre-commit-hooks.nix/cb770e93516a1609652fa8e945a0f310e98f10c0' (2023-09-24)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/c0ad320f9aadcc3cb1e62794cb950fe243e077d6' (2023-09-23)
  → 'github:oxalica/rust-overlay/a4c3c904ab29e04a20d3a6da6626d66030385773' (2023-09-30)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-10-03 14:23:11 +00:00
jneem
7f1be1812f
Update lsp notes (#1660) 2023-10-02 14:29:20 +00:00
jneem
432983cd10
Nuke the linearizer (#1658)
* Convert hover

* WIP

* Slight cleanups

* Rename LinRegistry
2023-10-02 14:29:14 +00:00