1
1
mirror of https://github.com/tweag/nickel.git synced 2024-10-06 16:18:08 +03:00
Commit Graph

3902 Commits

Author SHA1 Message Date
Yann Hamdaoui
84b5fcf580
Get rid of old jargon "enriched" (#1350) 2023-06-09 11:33:45 +00:00
Viktor Kleen
ce9501df69
Replace Term::deep_repr by the pretty printer (#1262)
* Replace Term::deep_repr by the pretty printer

* Move `BoxAllocator` back to a more local scope
2023-06-09 07:59:44 +00:00
Yann Hamdaoui
04e7768b08
Document review process (#1345) 2023-06-08 14:50:09 +00:00
jneem
dc6804acd1
Adds a configurable tracing output instead of hardcoding stderr (#1338)
* Make the trace destination configurable

* Add a callback-oriented trace collector to the wasm repl

* Only call back on flush

* Fix clippy

* Silence trace output in pyckel.

This probably isn't the best thing, but it's probably still better than
polluting stderr in a library. Possibly a better solution is to
imitate the api of `subprocess.run`, but that requires breaking API
to return something other than a plain string.
2023-06-07 14:17:13 +00:00
Yann Hamdaoui
89a1382cfd
flake.lock: Update (#1201)
* flake.lock: Update

Flake lock file updates:

• Updated input 'crane':
    'github:ipetkov/crane/5291dd0aa7a52d607fc952763ef60714e4c881d4' (2023-03-07)
  → 'github:ipetkov/crane/35110cccf28823320f4fd697fcafcb5038683982' (2023-05-25)
• Updated input 'crane/flake-utils':
    'github:numtide/flake-utils/3db36a8b464d0c4532ba1c7dda728f4576d6d073' (2023-02-13)
  → 'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11)
• Added input 'crane/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'crane/rust-overlay':
    'github:oxalica/rust-overlay/e53e8853aa7b0688bc270e9e6a681d22e01cf299' (2023-03-03)
  → 'github:oxalica/rust-overlay/d59c3fa0cba8336e115b376c2d9e91053aa59e56' (2023-05-03)
• Updated input 'flake-utils':
    'github:numtide/flake-utils/93a2b84fc4b70d9e089d029deacc3583435c2ed6' (2023-03-15)
  → 'github:numtide/flake-utils/a1720a10a6cfe8234c0e93907ffe81be440f4cef' (2023-05-31)
• Added input 'flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/ac718d02867a84b42522a0ece52d841188208f2c' (2023-03-15)
  → 'github:NixOS/nixpkgs/e635192892f5abbc2289eaac3a73cdb249abaefd' (2023-06-01)
• Updated input 'pre-commit-hooks':
    'github:cachix/pre-commit-hooks.nix/32b1dbedfd77892a6e375737ef04d8efba634e9e' (2023-03-16)
  → 'github:cachix/pre-commit-hooks.nix/ca2fdbf3edda2a38140184da6381d49f8206eaf4' (2023-05-29)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/7313c06ac334d6262ddfe30a38b3abc3da6bd565' (2023-03-18)
  → 'github:oxalica/rust-overlay/c535b4f3327910c96dcf21851bbdd074d0760290' (2023-06-03)
• Updated input 'topiary':
    'github:tweag/topiary/773159aa4c819b46c6d51ca9275e7366087eb3a0' (2023-04-26)
  → 'github:tweag/topiary/b2399161f60c1eb3404e487b4471ff76455d7a94' (2023-05-31)
• Updated input 'topiary/advisory-db':
    'github:rustsec/advisory-db/0888b44843e3c86db9fd56334c7f5261ea00dc19' (2023-03-15)
  → 'github:rustsec/advisory-db/0e97e6e71f0dd52b4b4e0ab3fa6e5e5dd72f852a' (2023-05-17)
• Updated input 'topiary/crane':
    'github:ipetkov/crane/5291dd0aa7a52d607fc952763ef60714e4c881d4' (2023-03-07)
  → 'github:ipetkov/crane/99de890b6ef4b4aab031582125b6056b792a4a30' (2023-05-19)
• Updated input 'topiary/crane/flake-utils':
    'github:numtide/flake-utils/3db36a8b464d0c4532ba1c7dda728f4576d6d073' (2023-02-13)
  → 'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11)
• Added input 'topiary/crane/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'topiary/crane/rust-overlay':
    'github:oxalica/rust-overlay/e53e8853aa7b0688bc270e9e6a681d22e01cf299' (2023-03-03)
  → 'github:oxalica/rust-overlay/d59c3fa0cba8336e115b376c2d9e91053aa59e56' (2023-05-03)
• Updated input 'topiary/flake-utils':
    'github:numtide/flake-utils/93a2b84fc4b70d9e089d029deacc3583435c2ed6' (2023-03-15)
  → 'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11)
• Added input 'topiary/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'topiary/nix-filter':
    'github:numtide/nix-filter/aa9ff6ce4a7f19af6415fb3721eaa513ea6c763c' (2023-03-06)
  → 'github:numtide/nix-filter/f529f42792ade8e32c4be274af6b6d60857fbee7' (2023-04-10)
• Updated input 'topiary/rust-overlay':
    'github:oxalica/rust-overlay/7313c06ac334d6262ddfe30a38b3abc3da6bd565' (2023-03-18)
  → 'github:oxalica/rust-overlay/a227d4571dd1f948138a40ea8b0d0c413eefb44b' (2023-05-23)
• Updated input 'topiary/rust-overlay/flake-utils':
    'github:numtide/flake-utils/c0e246b9b83f637f4681389ecabcb2681b4f3af0' (2022-08-07)
  → 'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11)
• Added input 'topiary/rust-overlay/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'topiary/rust-overlay/nixpkgs':
    'github:NixOS/nixpkgs/14ccaaedd95a488dd7ae142757884d8e125b3363' (2022-10-09)
  → 'github:NixOS/nixpkgs/96ba1c52e54e74c3197f4d43026b3f3d92e83ff9' (2023-04-13)

* flake: Explicitly set wasm-pack cache dir (#1343)

It tries to create it in home directory that doesn't exist in sandbox
and build fails with this:

```
nickel-lang> ++ command cargo --version
nickel-lang> cargo 1.70.0 (ec8a8a0ca 2023-04-25)
nickel-lang> Error: Permission denied (os error 13)
nickel-lang> Caused by: Permission denied (os error 13)
```

Fix failure in #1201.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Yuriy Taraday <yuriy.taraday@tweag.io>
2023-06-07 09:41:49 +00:00
Viktor Kleen
43bc8fee6a
Add a GitHub action for automatically uploading release artifacts (#1339)
* Add a GitHub action for automatically uploading release artifacts

The action is triggered on publishing a GitHub release and automaticlly
builds the `dockerImage` and `nickel-static` flake outputs for x86_64
Linux. It then uploads the results as release artifacts on GitHub.

* Apply suggestions from code review

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

* Add a small note about release branch targets

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-06-05 10:57:55 +00:00
jneem
651ffdbc76
Refactor record type errors, and detect duplicate fields (#1337)
* Refactor record type errors

* Fix doc link

* Review comments
2023-06-02 15:29:40 +00:00
Viktor Kleen
495af70d07
Add flake output for static binaries on linux (#1322)
* Add flake output for static binaries on linux

* Use static nickel binaries for the docker image

* Use Entrypoint instead of Cmd for the docker image
2023-06-02 07:39:21 +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
jneem
2056f745ab
Fix panic when interpolating fields in a record type (#1332)
* Fix panic when interpolating fields in a record type

* newline

* Add missing snapshot
2023-05-30 19:46:45 +00:00
jneem
9d2ae5b327
Fix error position (#1333) 2023-05-30 19:46:15 +00:00
jneem
d334f5b582
Give a better error message when trying to query a non-record (#1326)
* Set the query error pos to before evaluation

* Make querying a non-record its own error variant
2023-05-30 17:29:00 +00:00
matthew healy
afdaff57ce
Prevent panic when parsing record type with field path (#1325)
Nickel does not support record types with field paths. i.e. while this
is a valid type:

```
{ x : { y : String } }
```

this is not:

```
{ x.y : String }
```

However, at some point rather than raising the appropriate error here,
we started panicking. This commit fixes that by checking that a field's
path only contains a single element before deciding whether to allow
it in a record type.
2023-05-26 14:26:41 +00:00
matthew healy
9a2e2fcfcd
Fix panic on duplicated top-level idents in record destructuring (#1324)
Previously Nickel would panic when encountering code like this:

```
let f = fun { x, x } = x in f { x = 1 }
```

This commit fixes that by checking each destructured record pattern for
duplciated identifiers at parsing time, and returning an error if any
are encountered.

Note, however, that in order to preserve backwards compatibility with
Nickel 1.0, the following code is still valid (and returns `1`):

```
let f = fun { x = { y }, z = { y } } => y
in f { x = { y = 1 }, z = {  y = 2 } }
```
2023-05-26 09:41:35 +00:00
Viktor Kleen
52d08c59d5
Sync README.md with manual introduction (#1321) 2023-05-25 14:25:12 +00:00
matthew healy
808b98490b
Improve error messages for polymorphic tail parametricity violations (#1320)
Previously, if we had a type whose return value contained a polymorphic
tail and we tried to return a value which was not statically known
to be in the return type, we would see a type mismatch error with an
"invented" type name (e.g. `a`) to represent "an arbitrary type in the
tail".

This made it unclear where the problem was, and didn't give any real
direction on how to fix the problem.

This commit raises a specific error in this case, which informs users
that the type they've tried to return is not guaranteed to exist in the
polymorphic tail. We also now pass around a var kind with type errors
related to constant mismatches, so we can print a representation of the
tail type (e.g. `[| ; x |]`) instead of inventing phantom type names
for errors.

Fixes #1316.
2023-05-25 11:26:56 +00:00
dependabot[bot]
ff13b2d972
chore(deps): bump cachix/install-nix-action from 20 to 21 (#1319)
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 20 to 21.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v20...v21)

---
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-05-25 10:40:09 +00:00
Viktor Kleen
f8c8a02375
Fixes incorrect variable names in type mismatch errors (#1313)
* Fixes incorrect variable names in type mismatch errors

In certain cases, it was possible for a row type variable to alias an
existing type variable, causing confusing error messages. This commit
fixes that by tracking type variable kinds together with their IDs.

Fixes #1312

Co-authored-by: Matthew Healy <matthew.healy@tweag.io>

* Pass VarId and VarKind separately for nicer call sites

* Update test expectations

---------

Co-authored-by: Matthew Healy <matthew.healy@tweag.io>
2023-05-23 14:34:30 +00:00
matthew healy
b8094824b0
Convert tests to new annotated format, pt. 3 (#1314)
* Convert stdlib_arrays_fail test to new annotated format

* Convert typecheck_fail to new annotated format

* Convert unbound_type_variables to new annotated format

* Convert imports to new annotated format
2023-05-23 12:48:32 +00:00
matthew healy
d2f5cb5250
Convert tests to new annotated format, pt. 2 (#1303)
* Convert infinite_rec tests to new format

* Convert merge_fail tests to new format

* Convert parse_fail tests to new format

* Convert records_fail tests to new format
2023-05-22 09:26:31 +00:00
Kevin K
01bc906b67
Migrate to clap (#1309)
* migrate nls from structopt to clap

* migrate nickel from structopt to clap

* qualify traits coming from clap

* use clap::ColorChoice with ColorOpt as a newtype

* remove explicit default() for value enums

[clap
Documentation](https://docs.rs/clap/latest/clap/_derive/index.html#arg-attributes)
states it will use `Default::default()` so there is no need to
explicitly call it.

* remove manual FromStr implementations and rely on ValueEnum

deriving `clap::ValueEnum` implements `FromStr` for the type, so doing
so manually isn't required any longer.

* Persuade `clap` to use default values

---------

Co-authored-by: Viktor Kleen <vkleen+github@17220103.de>
2023-05-22 09:02:21 +00:00
matthew healy
6344e93c35
Convert tests to new annotated format, pt. 1 (#1301)
* Use single quote for consistency

* Convert contracts_fail to ncl files

* Convert existing ncl source files to annotated tests

This commit converts every existing .ncl file used in tests to an
annotated source file. This means we can change the glob we use to
pick up every .ncl file in the integration test subdirectory, which
makes test organisation significantly more flexible (and should
solve the problem of very long test file names by supporting arbitrary
nesting).

One additional change I had to make here, which increased the diff
significantly, is to add `repeat` functionality to the test annotations,
which allow a test to be re-run an arbitrary number of times. This is
to support tests where behaviour may be non-deterministic (e.g. it
occurs as the result of iterating through a `HashMap`).
2023-05-22 00:12:58 +00:00
Viktor Kleen
79abacfb37
Update roadmap in manual introduction (#1307) 2023-05-21 14:25:17 +00:00
Yann Hamdaoui
c4da6975b3
Bump version to 1.0 (#1302)
* Bump version number to 1.0

* Add text for 1.0 release
2023-05-17 12:50:43 +00:00
matthew healy
f11b7b09e2
Add test infra to perform arbitrary checks on annotated ncl source files (#1298)
* Add integration test infra to test for errors

* Rewrite eq_fail test as .ncl files

* Parse test expectation from header comment

This ensures that the test input files are still valid Nickel source
code.

* Use file path as thread & program name

* Fix clippy warnings

* Refactor for clarity

* Remove unnecessary Serialize impl

* PoC: annotation-based snapshot tests

* Split utilities crate into modules

* Extract annotated test code to utilities crate

* Use annotations for snapshot tests

* Convert basics_fail.rs to use test annotations

* Disable clippy warning about ErrorExpectation variant names

* Use common annotation parsing code for example tests

* Update tests README

* Remove println

* Update tests/README.md

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

---------

Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-05-16 06:56:10 +00:00
Viktor Kleen
5c3a4986d3
Update the manual introduction (#1299) 2023-05-15 18:29:37 +00:00
Viktor Kleen
ffa3d0c635
Fix position tracking for metadata queries (#1297) 2023-05-11 10:20:31 +00:00
matthew healy
119dc4fd17
Raise blame error when trying to access fields in the sealed tail of a polymorphic record (#1296)
* Raise blame error when statically accessing sealed field

* Raise blame error when removing sealed field from record

* Raise blame error when dynamically accessing sealed field

* Store a vec of idents to avoid allocating strings on a hot codepath
2023-05-05 15:07:30 +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
Yann Hamdaoui
5cfa4e1831
Add cargo doc to flake checks (#1291)
* Add a flake check that `cargo doc` succeeds

* Fix cargo doc warnings for NLS

* Update RELEASING.md, remove manual doc build check
2023-04-28 08:32:29 +00:00
Yann Hamdaoui
1f553db6ba
Fix cargo --doc warnings (#1289)
* Fix cargo --doc warnings

* Update src/parser/uniterm.rs

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

---------

Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-04-27 15:17:13 +00:00
Yann Hamdaoui
4e7cd8cdca
Update RELEASES.md to prepare 1.0 (#1288) 2023-04-27 13:05:06 +00:00
Viktor Kleen
15258de690
Keep track of field names in labels (#1287)
* Keep track of field names when transforming records for generating contract applications

* Add snapshot tests for some blame errors

* Apply suggestions from code review

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

* Fix snapshot tests

* Move label field name tracking into the parsing phase

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-04-27 11:41:43 +00:00
Viktor Kleen
913a7c1e12
Update topiary to latest version (#1286) 2023-04-26 13:01:40 +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
Yann Hamdaoui
83684d51b5
Pass on error messages (#1285)
* Format deploy-example.ncl

* Pass on error messages and definitions

* Remove unused RowKindMismatch error variant

This error variant is a leftover from a time where types, record row types and
enum row types were all merged in one Rust enum, and we could end up in
situations where we try to unify a record row with an enum row.
Nowadays, those type are properly distinguished and nested, avoiding
this situation at compile-time.

* Second half of the pass on error messages

* Fix test after changing a type definition

* Update snapshot tests after error messages pass

* 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-25 23:51:06 +00:00
Viktor Kleen
1baeb0c946
Make partially applied boolean operators work (#1282)
* Make partially applied boolean operators work

* Add a comment explaining the special treatment for (&&) and (||)
2023-04-25 15:00:16 +00:00
Viktor Kleen
d11c2e834b
Update topiary in the devshell (#1283) 2023-04-25 14:59:09 +00:00
Viktor Kleen
f2652dc27f
Use transform for the stdlib and :load in the REPL (#1278)
* Use `transform` for the stdlib and `:load` in the REPL

* Update src/repl/mod.rs

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

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
2023-04-24 16:06:39 +00:00
Yann Hamdaoui
a5f20ca89f
Fix query path parsing (#1276)
* Fix query path parsing

The parsing of a field path when querying metadata was broken (when
using quotes). Instead of duplicating the parsing logic, this commit
makes the query path code to piggy back on the actual Nickel parser to
parse a field path.

* Field renaming

* Update src/identifier.rs

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

* Please the Clippy God

---------

Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-04-24 11:31:49 +00:00
Viktor Kleen
9275ac18df
Use record.insert for std.record.from_array instead of merging (#1273)
* Use record_insert instead of merge for std.record.from_array

* Use a type annotation for std.merge_all

* Run topiary on `stdlib/std.ncl`

* Fix a topiary formatting bug

* Move merge_all back into std.record
2023-04-24 09:27:37 +00:00
Yann Hamdaoui
988205650a
Fix clippy failing on master (#1275)
* Fix clippy failing on master

* Trigger deploy preview on merge queue (#1277)

---------

Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-04-24 08:50:22 +00:00
Yann Hamdaoui
6a69e076c1
Fix escaping of contracts' custom error message (#1274)
Custom contract errors were escaped too agressively (such as turning
`"` into `\"`), while we only want to escape ANSI escape sequences to
avoid messing up Nickel's error reporting. This commits use a
specialized crate to do that, instead of Rust's std `escape`.
2023-04-21 13:52:08 +00:00
Yann Hamdaoui
91a2e03f8d
Introduce dictionary contracts (#1272)
* Separate between dictionary types and contracts

Since a recent addition, contracts derived from record types and
contracts derived from record contracts are different. The later are
local and don't propagate, while the former are propagated through
merging. This change calls for the same distinction for dictionaries.

This commit thus add two different dictionary syntax, the original
dictionary type `{_ : T}`, which derived contract is restored back to a
previous version where it's a mere map of the contract application of
`T` over the elements, and a new grammatical construct `{_ | T}` is
introduce, which contract is set to the contract used by `{_ : T}` in
the previous commit (which is a lazy, propagating contract).

As to make the impact of the change minimal, including for the LSP and
the error reporting of blame errors, `{_ | T}` is a variant of the
dictionary type which behave mostly exactly the same but for contract
generation. This way, the LSP, the typechecker and error reporting code
can stay mostly unchanged.

* Fix tests and pretty printing to use dict contracts

* Add more tests for dictionary type vs contract

* Formatting

* Fix type variable fixing for dictionary contracts

* Update LSP for new dict contracts

* Move (and fix) capture type variable test

* DictAttrs -> DictTypeFlavour
2023-04-21 13:50:28 +00:00
Yann Hamdaoui
116fdb3591
Make type annotations to not propagate through merging (#1271)
* First draft of making type not propagating

* Consider record types as such whenever possible

Before this change, a record literal was considered a record type
whenever it met a bunch of conditions AND was used in a type position.
This meant that `{foo : Number, bar : String}` was always considered as
a normal record (fields without definition) when used in a term
position. This was already subtly wrong, because this means for example
that `x | {foo : Number}` and `let C = {foo : Number} in x | C` are
operationally not equivalent.

Now that we've made a stronger distinction between static types and
contracts (types don't propagate through merging), then this behavior
is just unsound. As per this commit, a record literal is considered a
record type whenever it satisfies the syntactic conditions, be it in a
type or a term position.

Additionally, we've forbidden "mixed" style records, that is record
literals that are not a record type, but with fields that have a type
annotation and no definition. Beside being meaningless, they can be
deceiving, and are most often an error or a confusion from users. Either
the should use a record type, or use `|` everywhere, as in a record
contract.

* Fix tests after forbidding typed fields without definition

* More tests on types vs contracts propagation

* Formatting

* Apply suggestions from code review

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

* Update snapshot test output after typo fixup

---------

Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
2023-04-21 10:38:18 +00:00
Yann Hamdaoui
bdc5f08a62
Pass on the top-level symbols of std (#1270)
* Pass on the doc of the std top-level symbols

* 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-19 17:14:49 +00:00
Yann Hamdaoui
f9678b21e8
Pass on the documentation of std.string (#1269)
* Pass on the documentation of std.string

* Fix tests for more restrictive string.to_bool/from_bool

* 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-19 16:21:50 +00:00
Yann Hamdaoui
d204a1040b
Pass on documentation of std.record (#1268) 2023-04-19 14:48:26 +00:00