* Fix order of arguments for curried dot operator
* Add std.record.get to stdlib
* Update release note with breaking changes for (.)
Co-authored-by: jneem <joeneeman@gmail.com>
* Remove snapshot test for std.record.get
Unfortunately, the output of the error message shows a closure address
(in practice, a memory address), which makes it non-determinstic and
thus unfit for a snpashot test.
Instead, it's been replaced with an integration test, which
Unfortunately won't allow to detect a deterioriation in error reporting,
but at least ensure that the contract of `std.record.get` works as
expected.
---------
Co-authored-by: jneem <joeneeman@gmail.com>
* 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
* 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>
* 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>
* 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
* 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>
* Revert "[Fix] Fix bad lexing of mutline string closing delimiter (#1435)"
This reverts commit 664c397aad.
After more investigation, it turns out the original change made it very
annoying to interpolate something between double quotes, because it
conflicts with the multiline string end delimiter:
m%" "%{hello}" "%
After the reverted change, this wouldn't parse correctly anymore. One
can escape the first quote, but it's verbose and harder to read:
m%" %{"\""}%{hello}" "%
Although, we can't see any case where an interpolation sequence with a
heading quotes would have a valid meaning in the reverted commit's
model: it's always an error (applying a string to something). Thus, if
there's a sequence `"%{` in a string, there is no other meaningful
interpretation than this is a quote followed by an interpolation
sequence.
We thus decided to revert this change, although it derives a bit from
the most simple interpretation of parsing multiline string.
* Post-revert fixup: restore some comments and renamings
* Document multiline string parsing special case
* Update core/src/parser/lexer.rs
Co-authored-by: jneem <joeneeman@gmail.com>
* Fix interpolation sequence in pretty printer
---------
Co-authored-by: jneem <joeneeman@gmail.com>
* Fix some leftover instances of the old enum syntax in the manual
* Update doc/manual/syntax.md
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
---------
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
* fixed dangling link and incorrect cmd invocation
* set number to be explicit type
* Update doc/manual/contracts.md
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@gmail.com>
* export -> format
---------
Co-authored-by: Yann Hamdaoui <yann.hamdaoui@gmail.com>
Currently `import` is treated as a very special function that only
accepts literal string as its first argument. It has following
downsides:
* Special handling of `import` is hidden. User can assume that its
just a function while it's a special keyword. User might expect to
be able to pass variables to it while it is only handled before
typechecking and evaluation.
* We can't extend `import` functionality without introducing new
keywords which is not backward-compatible.
This change makes `import` into another statement like `let` or `fun`,
which means it cannot be confused with a function anymore. It also means
that expressions like `import "foo.ncl" bar` and
`import "foo.ncl" & {..}` are invalid, and `import` statement need to be
put in parethesis: `(import "foo.ncl") bar`.
For more context, see discussion in
https://github.com/tweag/nickel/issues/329#issuecomment-1531333491
* Change enum token start from backtick to single-quote
* Get tests to pass
* Fix printing in Term::shallow_repr
* Fix benchmark enum tag syntax
* Change enum tags in the documentation to the new syntax
* Pass on the tutorial
* Update doc/manual/tuto.md
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
---------
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
* Pass on the merging section of the manual
* Apply suggestions from code review
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
* Fix line too long (markdownlint failure)
---------
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
* Pre 1.0 pass on the typing section of the manual
Make a pass on the typing section of the user manual, formatting code
examples with topiary, updating error messages to match the current
master and restructure the text whenever necessary.
* Apply suggestions from code review
Corrections for the typing section of the manual.
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
Co-authored-by: Oghenevwogaga Ebresafe <gaga.ebresafe@tweag.io>
---------
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
Co-authored-by: Oghenevwogaga Ebresafe <gaga.ebresafe@tweag.io>
* Pass on the contracts manual section
Make a pass on the contract manual section, ensuring that:
- most examples are valid program (a lot of them were unsing truncated
let-binding: I've put them inside records)
- examples are running against current master
- error messages correspond to current master
- information and syntax correspond to current master
I've tried to make the text a bit easier to read when I could as well.
* Apply suggestions from code review
Fix typos in the contracts section of the manual.
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
---------
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
* Update contracts manual section post-RFC005
Update the documentation about contracts to take into account the new
semantics of merging and lazy propagation introduced in RFC005.
* Update the manual section on syntax
Update the syntax section to mirror the new restrictions introduced by
RFC005 (metadata can only appear at the level of a field). Took the
occasion to add a section on type and type annotations as well
(reflecting changes of RFC002).
* Apply suggestions from code review
Fix typos and improve rewording in the latest addition to the user manual.
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
* Num -> Number in manual
---------
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>