about summary refs log tree commit diff
path: root/tvix/eval/src/warnings.rs (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-06-11 r/6266 fix(tvix/eval): emit only warnings on shadowed outputsLinus Heckemann1-0/+7
Unfortunately, nixpkgs has at least one case[1] where the out environment variable is shadowed -- though it doesn't cause a problem, since it's shadowed with the correct value, odd as this may be! [1]: https://github.com/NixOS/nixpkgs/blob/c7c298471676ac1c7789ab3c424fbcebecaa6791/pkgs/development/python-modules/pybind11/default.nix#L19 Change-Id: Ibf6790d2484dc9cce8e424feeb5886664d498dc3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8696 Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-23 r/5747 chore(tvix/eval): delete "useless parenthesis" warning/optimisationVincent Ambo1-4/+0
Two main reasons: 1. Traversing the structure to do this optimisation is actually *slower* than not optimising it. 2. There are literally hundreds of thousands of incidences of this in nixpkgs, and with some of the weird code there some of these (functionally) useless parens are actually required for readability reasons. Change-Id: I1044b1c5f9fe20df4b6085851fc3b191277c65dc Reviewed-on: https://cl.tvl.fyi/c/depot/+/7917 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2023-01-10 r/5642 fix(tvix/eval): address useless_format clippy warnAaqa Ishtyaq1-13/+6
This CL address clippy warnings related to use of 'format!' macro to return unmodified 'String'. Change-Id: I88726e59d8f39f6a455a8c1f48075b52d167e489 Signed-off-by: Aaqa Ishtyaq <aaqaishtyaq@gmail.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/7804 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-01-06 r/5607 feat(tvix/eval): skip & warn for useless parenthesisVincent Ambo1-0/+6
Change-Id: I567ca0682012b9d09f1217e57a104ac5671f8d82 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7771 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> Reviewed-by: flokli <flokli@flokli.de>
2023-01-06 r/5606 feat(tvix/eval): warn on empty let-bindingsVincent Ambo1-1/+7
Change-Id: Ib6ef7ce514abbd3e372dfe9df7137aa36dbda9d4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7770 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-01-06 r/5604 feat(tvix/eval): warn about empty `inherit`sVincent Ambo1-0/+6
Change-Id: I82bec6fe2210bcb88c46fd2fdf3e26bd613d1c1f Reviewed-on: https://cl.tvl.fyi/c/depot/+/7768 Reviewed-by: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-01-06 r/5602 feat(tvix/eval): implement initial compiler::optimiser moduleVincent Ambo1-0/+13
This optimiser can rewrite some expressions into more efficient forms, and warn users about those cases. As a proof-of-concept, only some simple boolean comparisons are supported for now. Change-Id: I7df561118cfbad281fc99523e859bc66e7a1adcb Reviewed-on: https://cl.tvl.fyi/c/depot/+/7766 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2022-12-21 r/5443 feat(tvix/eval): add configuration of Nix search path to public APIVincent Ambo1-0/+6
This is required for passing through NIX_PATH from the CLI. Change-Id: If129df79ef9c3ffab31408adb85679909276c4f0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7544 Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-05 r/5035 refactor(tvix/eval): introduce source::SourceCode typeVincent Ambo1-11/+11
This type hides away the lower-level handling of most codemap data structures, especially to library consumers (see corresponding changes in tvixbolt). This will help with implement `import` by giving us central control over how the codemap works. Change-Id: Ifcea36776879725871b30c518aeb96ab5fda035a Reviewed-on: https://cl.tvl.fyi/c/depot/+/6855 Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com>
2022-09-16 r/4877 feat(tvix/eval): implement legacy let syntaxVincent Ambo1-0/+6
... and emit a warning if anyone decides to use. Change-Id: Iaa6fe9fa932340e6d0fa9f357155e78823702576 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6611 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-09-13 r/4839 fix(tvix/eval): address current clippy lintsVincent Ambo1-2/+2
Change-Id: I5288849d0e93511b0b5664fa92f1c6882e4a1356 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6563 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-09-13 r/4830 feat(tvix/eval): implement initial fancy display for warningsVincent Ambo1-0/+90
This implements an initial fancy display for warnings emitted by the tvix compiler, using the codemap_diagnostic crate. Each warning variant has an associated message, and optionally an associated annotation for the span displayed to the user. In theory we could get a lot more fancy with the display for specific variants if needed (e.g. re-parse the AST and actually add multiple semantic spans based on context), but this is already a good start. Example: tvix-repl> let toString = https://tvl.fyi; in let inherit toString; in ({}: 42) rec {} warning[W004]: declared variable 'toString' shadows a built-in global! --> [tvix-repl]:1:5 | 1 | let toString = https://tvl.fyi; in let inherit toString; in ({}: 42) rec {} | ^^^^^^^^ variable declared here warning[W001]: URL literal syntax is deprecated, use a quoted string instead --> [tvix-repl]:1:16 | 1 | let toString = https://tvl.fyi; in let inherit toString; in ({}: 42) rec {} | ^^^^^^^^^^^^^^^ warning[W002]: inherited variable already exists with the same value --> [tvix-repl]:1:40 | 1 | let toString = https://tvl.fyi; in let inherit toString; in ({}: 42) rec {} | ^^^^^^^^^^^^^^^^^ warning[W999]: feature not yet implemented in tvix: recursive attribute sets --> [tvix-repl]:1:70 | 1 | let toString = https://tvl.fyi; in let inherit toString; in ({}: 42) rec {} | ^^^^^^ warning[W999]: feature not yet implemented in tvix: closed formals --> [tvix-repl]:1:62 | 1 | let toString = https://tvl.fyi; in let inherit toString; in ({}: 42) rec {} | ^^ warning[W003]: variable 'toString' is declared, but never used: --> [tvix-repl]:1:5 | 1 | let toString = https://tvl.fyi; in let inherit toString; in ({}: 42) rec {} | ^^^^^^^^ variable declared here => 42 :: int These are coloured when output to a terminal. Change-Id: If315648a07e333895db4ae1d0915ee2013806585 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6532 Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-09-11 r/4823 refactor(tvix/eval): remove `todo!()` calls in compilerVincent Ambo1-1/+1
It is impossible for tvixbolt to recover from panics, so the user experience of typing an expression using an unsupported feature was that it would get sad and stop responding to input. Instead, raise a normal value-level error of a new variant and continue where possible. Change-Id: Ibe016c92cacb87b85095c0f83758eddc6468053e Reviewed-on: https://cl.tvl.fyi/c/depot/+/6528 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-09-11 r/4790 feat(tvix/eval): implement "formals" function parametersVincent Ambo1-0/+4
The comment explains how this works fairly well. Note that this does not yet have the ability to check "closed formals", i.e. without an ellipsis Tvix will *NOT* fail if unexpected attribute set keys are provided. Change-Id: I0d2b77e893243093d2789baa57f876d35d0a32ff Reviewed-on: https://cl.tvl.fyi/c/depot/+/6463 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-09-07 r/4737 refactor(tvix/eval): store spans instead of nodes in Warning/ErrorVincent Ambo1-1/+1
Another step towards being able to report accurate errors. The codemap spans contain strictly more accessible information, as they now retain information about which input file something came from. This required some shuffling around in the compiler to thread all the right information to the right places. Change-Id: I18ccfb20f07b0c33e1c4f51ca00cd09f7b2d19c6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6404 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-09-02 r/4591 feat(tvix/eval): emit warnings when globals are being shadowedVincent Ambo1-0/+1
Change-Id: I7dae6978c2a4548382d7fa059b20ccdf35d2cf7f Reviewed-on: https://cl.tvl.fyi/c/depot/+/6257 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-09-01 r/4573 feat(tvix/eval): emit warnings for unused local bindingsVincent Ambo1-0/+1
Change-Id: I6e876a8f4d062297abae812b14ed8ec17a502f2c Reviewed-on: https://cl.tvl.fyi/c/depot/+/6237 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2022-08-30 r/4540 docs(tvix/eval): Use correct syntax for module doc commentsVincent Ambo1-2/+2
Change-Id: I35741856f34b86a538f226a8eaf8806edede60ec Reviewed-on: https://cl.tvl.fyi/c/depot/+/6207 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-08-29 r/4529 feat(tvix/eval): emit warnings on useless inheritVincent Ambo1-0/+1
Change-Id: Ifb9993cf8b85393eb43e1b204c7ab2f889b7113b Reviewed-on: https://cl.tvl.fyi/c/depot/+/6194 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-08-26 r/4508 feat(tvix/eval): add warning for deprecated URL literalsVincent Ambo1-1/+3
Change-Id: I8a9cfcb5d99680344ee0e3461a4a52526b846c92 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6175 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi> Reviewed-by: sterni <sternenseemann@systemli.org>
2022-08-26 r/4507 feat(tvix/eval): add mechanism for emitting warnings from compilerVincent Ambo1-0/+11
These can be used predominantly to emit warnings about things that the compiler can infer, such as deprecated language features. Change-Id: I3649c625459d7f3f95cdf42d5c651d23d66569ec Reviewed-on: https://cl.tvl.fyi/c/depot/+/6174 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI