forked from tweag/nickel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the original unevaluated type and contract annotation in `nickel …
…doc` (tweag#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 tweag#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 tweag#1519 * Add a snapshot test against regressions
- Loading branch information
Showing
4 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# capture = 'stdout' | ||
# command = ['doc', '--stdout', '--format=json'] | ||
{ | ||
foo | { x | Dyn, y } | ||
} |
5 changes: 5 additions & 0 deletions
5
cli/tests/snapshot/snapshots/snapshot__doc_stdout_evaluation.ncl.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: cli/tests/snapshot/main.rs | ||
expression: out | ||
--- | ||
{"foo":{"fields":null,"type":null,"contracts":["{ x | Dyn, y, }"],"documentation":null}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters