1
1
mirror of https://github.com/tweag/nickel.git synced 2024-10-06 08:07:37 +03:00
nickel/cli
Viktor Kleen 3df013169b
Use the original unevaluated type and contract annotation in nickel doc (#1529)
* Use the original unevaluated type and contract annotation in `nickel doc`

With this change we no longer print evaluated types or contracts in
field annotations for `nickel doc`. Ever since `nickel doc` started
evaluating terms to address #1462 contract and type annotations would be
evaluated before reaching the documentation extraction stage. This means
they would be affected by program transformations and the result would
most likely be meaningless to the user.

Incidentally, `nickel query` already correctly used the original
unevaluated type for contract annotations but not for type annotations.
If a type annotation contains a `Term` as a `TypeF::Flat` variant, it
was possible to trigger the same undesirable behaviour:

```
❯ cargo run --bin nickel -- query foo <<<'{ foo : { x | Dyn, y } = {x = 1, y = 2} | { x | Dyn, y } }'
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/nickel query foo`
• type: let %182 = $dyn in { x | Dyn, y, }

Available fields
• x
• y
```

Fixes #1519

* Add a snapshot test against regressions
2023-08-14 13:34:14 +00:00
..
src LSP formatting without calling the topiary binary (#1526) 2023-08-11 18:02:21 +00:00
tests Use the original unevaluated type and contract annotation in nickel doc (#1529) 2023-08-14 13:34:14 +00:00
Cargo.toml LSP formatting without calling the topiary binary (#1526) 2023-08-11 18:02:21 +00:00