libexpr: Warn on incorrect string escapes
In Nixpkgs, there are several strings like "\d\.\d" which attempt to be a regex but are just literally "d.d". The escaping rules are silly and we should warn our users about that. Co-authored-by: Commentator2.0 <lix@crystal-cavern.systems> Change-Id: I779b0757358fc9adc34dc140e1670b83abc93b67
This commit is contained in:
co-authored by
Commentator2.0
parent
f1fbd1d095
commit
56dee9186f
@@ -0,0 +1,26 @@
|
||||
warning: \a is an ill-defined escape. You can drop the \ and simply write a instead. Use --extra-deprecated-features broken-string-escape to silence this warning.
|
||||
at /pwd/in.nix:1:3:
|
||||
1| "\a\n\{\$\"\'\r\v\\\t
|
||||
| ^
|
||||
2| \f"
|
||||
warning: \{ is an ill-defined escape. You can drop the \ and simply write { instead. Use --extra-deprecated-features broken-string-escape to silence this warning.
|
||||
at /pwd/in.nix:1:7:
|
||||
1| "\a\n\{\$\"\'\r\v\\\t
|
||||
| ^
|
||||
2| \f"
|
||||
warning: \' is an ill-defined escape. You can drop the \ and simply write ' instead. Use --extra-deprecated-features broken-string-escape to silence this warning.
|
||||
at /pwd/in.nix:1:13:
|
||||
1| "\a\n\{\$\"\'\r\v\\\t
|
||||
| ^
|
||||
2| \f"
|
||||
warning: \v is an ill-defined escape. You can drop the \ and simply write v instead. Use --extra-deprecated-features broken-string-escape to silence this warning.
|
||||
at /pwd/in.nix:1:17:
|
||||
1| "\a\n\{\$\"\'\r\v\\\t
|
||||
| ^
|
||||
2| \f"
|
||||
warning: \f is an ill-defined escape. You can drop the \ and simply write f instead. Use --extra-deprecated-features broken-string-escape to silence this warning.
|
||||
at /pwd/in.nix:2:2:
|
||||
1| "\a\n\{\$\"\'\r\v\\\t
|
||||
2| \f"
|
||||
| ^
|
||||
3|
|
||||
@@ -0,0 +1 @@
|
||||
"a\n{$\"'\rv\\\t\nf"
|
||||
@@ -0,0 +1,2 @@
|
||||
"\a\n\{\$\"\'\r\v\\\t
|
||||
\f"
|
||||
@@ -0,0 +1,9 @@
|
||||
[[test]]
|
||||
runner = "eval-okay"
|
||||
matrix = true
|
||||
flags = ["--extra-deprecated-features", "broken-string-escape"]
|
||||
in = ["in.nix", "in-backslash-newline.nix"]
|
||||
|
||||
[[test]]
|
||||
runner = "eval-okay"
|
||||
in = "in-escapes.nix"
|
||||
Reference in New Issue
Block a user