1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 20:41:47 +02:00

Merge pull request #10592 from hercules-ci/builtins-warn

Add `builtins.warn`
This commit is contained in:
Eelco Dolstra 2024-06-03 17:16:32 +02:00 committed by GitHub
commit da92ad7dd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 173 additions and 22 deletions

View file

@ -240,7 +240,10 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
break;
}
case Verbosity::lvlWarn: {
prefix = ANSI_WARNING "warning";
if (einfo.isFromExpr)
prefix = ANSI_WARNING "evaluation warning";
else
prefix = ANSI_WARNING "warning";
break;
}
case Verbosity::lvlInfo: {

View file

@ -89,6 +89,11 @@ struct ErrorInfo {
HintFmt msg;
std::shared_ptr<Pos> pos;
std::list<Trace> traces;
/**
* Some messages are generated directly by expressions; notably `builtins.warn`, `abort`, `throw`.
* These may be rendered differently, so that users can distinguish them.
*/
bool isFromExpr = false;
/**
* Exit status.