about summary refs log tree commit diff
path: root/tvix/eval/src/warnings.rs (follow)
AgeCommit message (Collapse)AuthorFilesLines
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