* 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>
* 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>
* 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>
* 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
* build lalrpop in a separate derivation
* whoops
* get buildInputs from cargoArtifactsDeps
* small change to core (REVERT THIS)
* Revert "small change to core (REVERT THIS)"
This reverts commit 6284135ec8.
* don't build cargo artifacts for dev shell
* Duplicate contrat elision: first tentative
* Fix contract deduplication
The previous attempt wasn't fruitful, because we don't pass the initial
environment to the contract equality checker. This commit thread the
initial environment through the virtual machine and various functions to
make it available to the contract deduplicator
* Use contract deduplication for annotations as well
Use a special contract deduplication to avoid pretty printing many many
identical type annotations when evaluating. The actual contract
applications were already elided as far as evaluation is concerned, but
contracts annotations were still accumulated without deduplication.
* Rename elision->dedup which is better descriptive
* Fix clippy warning
* Fix cargo doc warnings
* Cosmetic improvements
* Mention idempotency assumption in the manual
* Update core/src/typecheck/eq.rs
Co-authored-by: Taeer Bar-Yam <Radvendii@users.noreply.github.com>
* Fix REPL query not working anymore
* Update core/src/typecheck/eq.rs
Co-authored-by: jneem <joeneeman@gmail.com>
* Formatting
* Fix clippy error
* Update core/src/program.rs
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
---------
Co-authored-by: Taeer Bar-Yam <Radvendii@users.noreply.github.com>
Co-authored-by: jneem <joeneeman@gmail.com>
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
https://github.com/tweag/nickel/pull/1580 introduced patching of
resulting binary in a separate derivation that ends up with bad
(or missing) code signature which prevents it from running:
% nix run
zsh: killed nix run
and Console.app revealing the reason:
Exception Type: EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
Exception Codes: UNKNOWN_0x32 at 0x00000001054e4199
Exception Codes: 0x0000000000000032, 0x00000001054e4199
This change uses autoSignDarwinBinariesHook to sign the result that
seems to fix the problem.
* Implement prototype metrics collection and reporting
* Add a few sample metrics
* Document some of the rationale
* Remove unused `metrics-utils`
* Don't enable metrics by default
* Report metrics to stderr
* Make `eval` CLI explicit and remove `-f`
* Implement multiple file inputs as merging
* Use `add_string` instead of `add_term`
* `format` cannot create files anymore
* Update snapshot tests
* Separate customize mode from the `export` subcommand
* Decouple customize mode from export and make it available for every evaluation
* Disable an `unused_mut` warning
* Apply suggestions from code review
Co-authored-by: jneem <joeneeman@gmail.com>
* Add a short option for `export --format`
* Update cli/src/eval.rs
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
---------
Co-authored-by: jneem <joeneeman@gmail.com>
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
Because of #1228 we syntactically forbid contracts from containing free
type variables. This was implemented in #1271 and #1272. As a result,
the double contract application in #1194 became dead code. This PR
removes the `%dualize%` primop, the `dualize` field in `Label` and the
double application logic when constructing recursive environments for
records.
* Run a REPL session when checking `nickel #repl` snippets
* Adjust examples in the manual for new checks
* Fix some leftover error messages
* Address code review
* Assume -> ApplyContract
At the very beginning of Nickel, the duality between a type annotation and
contract annotation was reflected in their original naming, the assume
construct (contract annotation) and the promise construct (a type
annotation).
This terminology isn't used anymore, and isn't very telling for new
contributors. This PR get rid of old references to `Assume` and
`Promise`, and rename the `Assume` primitive operation to the more
boring but more explicit `ApplyContract`.
* Formatting
* Add context completion
* Review comments
* Use either record completion or env completion, but not both
* Add test case for env completion
* Fix compilation
* First pass on testing snippets in `manual/syntax.md`
* Remove explicit `TestCase`
* Remove explicit panic
* Add test annotations to the manual
* Stop filtering markdown files
* Update `typing.md` example
* Apply suggestions from code review
Co-authored-by: jneem <joeneeman@gmail.com>
* Some tweaks to multi line string examples
* Move from `nickel-...` info strings to `nickel #...`
---------
Co-authored-by: jneem <joeneeman@gmail.com>
* Removed explicit state from Traverse trait
* Make clippy happy
* Consistent whitespace between documented items
I kept running into this while going through the codebase,
so I thought I'd fix it once and for all.
And no, I did not do this by hand. So I might have missed some cases.
* More formatting.
Mainly includes wrapping of comments to the 100 column mark,
as well as some more formatting on macros and strings.
* restore try_map_state in Traverse impl
* Removed IdentKind
It was technically only used in the PartialEq implmentation of Thunk.
Still, I don't think that had any effect.
* Fix doc comment
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@gmail.com>
---------
Co-authored-by: Taeer Bar-Yam <taeer.bar-yam@tweag.io>
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@gmail.com>
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
* Collect types into a table
* Type-based completion
This also adds a feature flag for turning off the old completer.
* Remove bogus file
* Explicitly visit type annotations
* Add a test for annotated types
* Only do one linearization traversal
* Fix docs, and avoid some clones
* Combine, and resolve metadata
* Add a test
* Slight improvements to the lsp spec
* Refactor
* Remove commented-out code
* Remove the confusing initial-env thing
* Complete the refactor, and document a little better
* Fix some rebase issues
* Clean up some unused code
* Remove obsolete doc
* Review comments