1
1
mirror of https://github.com/tweag/nickel.git synced 2024-09-11 11:47:03 +03:00
Commit Graph

215 Commits

Author SHA1 Message Date
Yann Hamdaoui
6ffa6ac0a1
Fix the order of argument in (.) (#1752)
* 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>
2024-01-09 10:11:48 +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
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
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
f06bda9239
Implement contract deduplication optimization (#1631)
* 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>
2023-09-28 16:23:43 +00:00
Viktor Kleen
17adb43f87
Run a REPL session for nickel #repl snippets (#1615)
* 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
2023-09-22 11:35:30 +00:00
Viktor Kleen
b02961324d
Testing Nickel snippets in the manual (#1611)
* 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>
2023-09-19 13:09:58 +00:00
Viktor Kleen
f28797ebf0
Update the version number in the manual introduction (#1607)
Update the version number to `1.2` and add a note to `RELEASING.md` so
we don't forget quite as often.
2023-09-15 09:11:14 +00:00
Yann Hamdaoui
d2316b6588
Revert to special casing the parsing of "%...%{ in multiline strings (#1566)
* 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>
2023-09-04 10:12:22 +00:00
Viktor Kleen
72992646d8
Fix some leftover instances of the old enum syntax in the manual (#1548)
* 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>
2023-08-28 10:24:25 +00:00
deotime
77aac6666b
Fix "wich" typo in documentation (#1547) 2023-08-27 10:47:35 +00:00
Viktor Kleen
da07e3ea55
Make the lexer accept scientific notation (#1456)
* Make the lexer accept scientific notation

* Mention scientific notation on doc/manual/syntax.md
2023-07-17 14:50:47 +00:00
Yann Hamdaoui
cd7eac27fe
Fix current version in manual and README (#1440) 2023-07-11 08:42:33 +00:00
foo-jin
f93b823c03
manual docs: fix mismatch between input command and its echo in the output (#1421)
* fix mismatch between input command and its echo in the output

* Update merging.md

---------

Co-authored-by: Viktor Kleen <vkleen+github@17220103.de>
2023-06-29 22:04:10 +00:00
Mikhail Katychev
018afbd6cb
Documentation fixes (#1335)
* 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>
2023-06-01 02:57:18 +00:00
Viktor Kleen
79abacfb37
Update roadmap in manual introduction (#1307) 2023-05-21 14:25:17 +00:00
Viktor Kleen
5c3a4986d3
Update the manual introduction (#1299) 2023-05-15 18:29:37 +00:00
Viktor Kleen
1be55fd6a3
Err on the side of too much syntax highlighting (#1295) 2023-05-04 15:44:20 +00:00
Yuriy Taraday
f553b8091c
Convert import to statement instead of pseudo-fun (#1293)
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
2023-05-04 15:25:16 +00:00
Viktor Kleen
9ba6a37e59
A quick pass over the merging section in the user manual (#1290)
* A quick pass over `doc/manual/merging.md`

* Update doc/manual/merging.md

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

* Address code review

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-04-28 08:49:44 +00:00
Viktor Kleen
c77cdcf03b
Change the enum tag start delimiter from backtick to single-quote (#1279)
* 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
2023-04-26 09:13:26 +00:00
Viktor Kleen
bc0f8a208c
A pass over user-manual/contracts.md (#1265) 2023-04-19 08:30:48 +00:00
Yann Hamdaoui
92e9be6cc6
Pass on the tutorial (#1260)
* 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>
2023-04-18 11:03:21 +00:00
Yann Hamdaoui
87275bae4a
Pass on type-vs-contracts manual section (#1259)
* Pass on type-vs-contracts manual section

* Apply suggestions from code review

Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>

---------

Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-04-18 10:54:49 +00:00
Yann Hamdaoui
3c311fd754
Update the roadmap (#1258) 2023-04-18 10:54:12 +00:00
Yann Hamdaoui
674faf5a13
Pass on the merging section of the manual (#1256)
* 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>
2023-04-18 10:15:06 +00:00
Viktor Kleen
ff3db409f9
Pass over doc/manual/syntax.md (#1254)
* Pass over `doc/manual/syntax.md`

* Address suggestions from code review

* Apply suggestions from code review

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

* Address code review

* Break up record type examples

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-04-18 09:45:27 +00:00
Yann Hamdaoui
96d48a6db9
Fix CI (markdownlint on typing section) (#1255) 2023-04-18 07:51:08 +00:00
Yann Hamdaoui
38aaf3ab11
Pass on the typing section of the manual (#1253)
* 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>
2023-04-17 16:20:42 +00:00
Yann Hamdaoui
ba90b6ec13
Pass on the correctness manual section
Make a pass on the correctness manual section, formatting examples with
Topiary, updating deprecated information, fixing small typos or bad
wording.
2023-04-17 16:58:44 +02:00
Yann Hamdaoui
f345c57590
Pass on the contracts manual section (#1250)
* 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>
2023-04-17 11:10:34 +00:00
Yann Hamdaoui
370b1f47a3
Update documentation to reflect RFC002 and RFC005 (#1237)
* 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>
2023-04-13 17:59:25 +02:00
Yann Hamdaoui
0b3b4ceac5
Update manual for new stdlib hierarchy (#1243) 2023-04-13 17:25:00 +02:00
Yann Hamdaoui
3482db2058
Update doc/manual/typing.md
Co-authored-by: Oghenevwogaga Ebresafe <gaga.ebresafe@tweag.io>
2023-03-17 16:33:19 +01:00
Yann Hamdaoui
5c96ec78c3
Update doc on number repr (moved away from floats) 2023-03-15 13:55:12 +01:00
Yann Hamdaoui
a9d0ac9388
Merge pull request #1172 from tweag/doc/symbolic-string
Add documentation for symbolic strings
2023-03-09 16:32:23 +01:00
Yann Hamdaoui
d231b89d09
Update doc/manual/syntax.md
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-03-09 16:14:11 +01:00
Yann Hamdaoui
2b997acd23
Update doc/manual/syntax.md
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-03-09 16:10:50 +01:00
Yann Hamdaoui
75ffa67740
Update doc/manual/syntax.md
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-03-09 16:10:43 +01:00
Yann Hamdaoui
acbb118230
Update doc/manual/syntax.md
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-03-09 16:10:27 +01:00
Yann Hamdaoui
f6433afdcd
Update doc/manual/syntax.md
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-03-09 16:08:25 +01:00
Yann Hamdaoui
aaa19d7c57
Symbolic strings: review suggestions + add delimiters info 2023-03-09 13:52:06 +01:00
Yann Hamdaoui
db6fcbc794
Fix typo in the manual (commad->command) 2023-03-09 12:48:22 +01:00
Yann Hamdaoui
0bac34596b
Rework symbolic str doc a bit, fix prefix specification 2023-03-09 12:41:51 +01:00
Yann Hamdaoui
4cd9edfb2b
Update doc/manual/syntax.md
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-03-09 12:23:44 +01:00
Yann Hamdaoui
b9035b3ff2
Update doc/manual/syntax.md
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-03-09 12:23:38 +01:00
Yann Hamdaoui
0a1927e711
Update doc/manual/syntax.md
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-03-09 12:23:08 +01:00
Yann Hamdaoui
45dcecc102
Add documentation for symbolic strings 2023-03-09 11:19:34 +01:00
Yann Hamdaoui
5c665e48b7
Merge pull request #1164 from tweag/task/long-type-names
Long names for `Str`, `Num`, related functions and modules
2023-03-09 10:33:01 +01:00
Yann Hamdaoui
e664828244
Merge pull request #1169 from tweag/doc/optional-fields
Add documentation for optional and not_exported
2023-03-09 10:22:44 +01:00