libexpr: Deprecate or in non-keyword positions
Test cases courtesy of rhenrdic Co-authored-by: Commentator2.0 <lix@crystal-cavern.systems> Change-Id: Id8df684ddd00d07b49e1c9e68bf41ee6c0e6887c
This commit is contained in:
co-authored by
Commentator2.0
parent
af166146ff
commit
17f1bcfd2c
@@ -0,0 +1 @@
|
||||
let or = 1; in 1 or
|
||||
@@ -0,0 +1 @@
|
||||
let or = 1; in [ (x: x) or ]
|
||||
@@ -0,0 +1,8 @@
|
||||
let
|
||||
x = 2;
|
||||
or = 2;
|
||||
in
|
||||
[
|
||||
builtins.add 1 x
|
||||
builtins.add 1 or
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
let
|
||||
x = 2;
|
||||
or = 2;
|
||||
in
|
||||
[
|
||||
[ 1 x ]
|
||||
[ 1 or ]
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
let or = 1; in { a = 2; }.a or (x: x) or
|
||||
@@ -0,0 +1,15 @@
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
or:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
body:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: or
|
||||
fun:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
@@ -0,0 +1,19 @@
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
or:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
body:
|
||||
_type: ExprList
|
||||
elems:
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: or
|
||||
fun:
|
||||
_type: ExprLambda
|
||||
arg: x
|
||||
body:
|
||||
_type: ExprVar
|
||||
value: x
|
||||
@@ -0,0 +1,38 @@
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
or:
|
||||
_type: ExprLiteral
|
||||
value: 2
|
||||
valueType: Int
|
||||
x:
|
||||
_type: ExprLiteral
|
||||
value: 2
|
||||
valueType: Int
|
||||
body:
|
||||
_type: ExprList
|
||||
elems:
|
||||
- _type: ExprSelect
|
||||
attrs:
|
||||
- add
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: builtins
|
||||
- _type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
- _type: ExprVar
|
||||
value: x
|
||||
- _type: ExprSelect
|
||||
attrs:
|
||||
- add
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: builtins
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: or
|
||||
fun:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
@@ -0,0 +1,30 @@
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
or:
|
||||
_type: ExprLiteral
|
||||
value: 2
|
||||
valueType: Int
|
||||
x:
|
||||
_type: ExprLiteral
|
||||
value: 2
|
||||
valueType: Int
|
||||
body:
|
||||
_type: ExprList
|
||||
elems:
|
||||
- _type: ExprList
|
||||
elems:
|
||||
- _type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
- _type: ExprVar
|
||||
value: x
|
||||
- _type: ExprList
|
||||
elems:
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: or
|
||||
fun:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
@@ -0,0 +1,29 @@
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
or:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
body:
|
||||
_type: ExprSelect
|
||||
attrs:
|
||||
- a
|
||||
default:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: or
|
||||
fun:
|
||||
_type: ExprLambda
|
||||
arg: x
|
||||
body:
|
||||
_type: ExprVar
|
||||
value: x
|
||||
e:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
a:
|
||||
_type: ExprLiteral
|
||||
value: 2
|
||||
valueType: Int
|
||||
recursive: false
|
||||
@@ -0,0 +1,9 @@
|
||||
[[test]]
|
||||
runner = "parse-okay"
|
||||
flags = ["--extra-deprecated-features", "or-as-identifier"]
|
||||
matrix = true
|
||||
|
||||
[[test]]
|
||||
name = "warning"
|
||||
runner = "parse-okay"
|
||||
matrix = true
|
||||
@@ -0,0 +1,10 @@
|
||||
warning: using or as an identifier is deprecated because it cannot be used in most places (try let or = 1; in or). Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:1:5:
|
||||
1| let or = 1; in 1 or
|
||||
| ^
|
||||
2|
|
||||
warning: using or as an argument is deprecated because it is parsed with the wrong precedence which may cause unexpected behavior. Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:1:18:
|
||||
1| let or = 1; in 1 or
|
||||
| ^
|
||||
2|
|
||||
@@ -0,0 +1,15 @@
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
or:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
body:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: or
|
||||
fun:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
@@ -0,0 +1,10 @@
|
||||
warning: using or as an identifier is deprecated because it cannot be used in most places (try let or = 1; in or). Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:1:5:
|
||||
1| let or = 1; in [ (x: x) or ]
|
||||
| ^
|
||||
2|
|
||||
warning: using or as an argument is deprecated because it is parsed with the wrong precedence which may cause unexpected behavior. Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:1:25:
|
||||
1| let or = 1; in [ (x: x) or ]
|
||||
| ^
|
||||
2|
|
||||
@@ -0,0 +1,19 @@
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
or:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
body:
|
||||
_type: ExprList
|
||||
elems:
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: or
|
||||
fun:
|
||||
_type: ExprLambda
|
||||
arg: x
|
||||
body:
|
||||
_type: ExprVar
|
||||
value: x
|
||||
@@ -0,0 +1,12 @@
|
||||
warning: using or as an identifier is deprecated because it cannot be used in most places (try let or = 1; in or). Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:3:5:
|
||||
2| x = 2;
|
||||
3| or = 2;
|
||||
| ^
|
||||
4| in
|
||||
warning: using or as an argument is deprecated because it is parsed with the wrong precedence which may cause unexpected behavior. Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:7:24:
|
||||
6| builtins.add 1 x
|
||||
7| builtins.add 1 or
|
||||
| ^
|
||||
8| ]
|
||||
@@ -0,0 +1,38 @@
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
or:
|
||||
_type: ExprLiteral
|
||||
value: 2
|
||||
valueType: Int
|
||||
x:
|
||||
_type: ExprLiteral
|
||||
value: 2
|
||||
valueType: Int
|
||||
body:
|
||||
_type: ExprList
|
||||
elems:
|
||||
- _type: ExprSelect
|
||||
attrs:
|
||||
- add
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: builtins
|
||||
- _type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
- _type: ExprVar
|
||||
value: x
|
||||
- _type: ExprSelect
|
||||
attrs:
|
||||
- add
|
||||
e:
|
||||
_type: ExprVar
|
||||
value: builtins
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: or
|
||||
fun:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
@@ -0,0 +1,12 @@
|
||||
warning: using or as an identifier is deprecated because it cannot be used in most places (try let or = 1; in or). Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:3:5:
|
||||
2| x = 2;
|
||||
3| or = 2;
|
||||
| ^
|
||||
4| in
|
||||
warning: using or as an argument is deprecated because it is parsed with the wrong precedence which may cause unexpected behavior. Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:7:13:
|
||||
6| [ 1 x ]
|
||||
7| [ 1 or ]
|
||||
| ^
|
||||
8| ]
|
||||
@@ -0,0 +1,30 @@
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
or:
|
||||
_type: ExprLiteral
|
||||
value: 2
|
||||
valueType: Int
|
||||
x:
|
||||
_type: ExprLiteral
|
||||
value: 2
|
||||
valueType: Int
|
||||
body:
|
||||
_type: ExprList
|
||||
elems:
|
||||
- _type: ExprList
|
||||
elems:
|
||||
- _type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
- _type: ExprVar
|
||||
value: x
|
||||
- _type: ExprList
|
||||
elems:
|
||||
- _type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: or
|
||||
fun:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
@@ -0,0 +1,10 @@
|
||||
warning: using or as an identifier is deprecated because it cannot be used in most places (try let or = 1; in or). Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:1:5:
|
||||
1| let or = 1; in { a = 2; }.a or (x: x) or
|
||||
| ^
|
||||
2|
|
||||
warning: using or as an argument is deprecated because it is parsed with the wrong precedence which may cause unexpected behavior. Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:1:39:
|
||||
1| let or = 1; in { a = 2; }.a or (x: x) or
|
||||
| ^
|
||||
2|
|
||||
@@ -0,0 +1,29 @@
|
||||
_type: ExprLet
|
||||
attrs:
|
||||
or:
|
||||
_type: ExprLiteral
|
||||
value: 1
|
||||
valueType: Int
|
||||
body:
|
||||
_type: ExprSelect
|
||||
attrs:
|
||||
- a
|
||||
default:
|
||||
_type: ExprCall
|
||||
args:
|
||||
- _type: ExprVar
|
||||
value: or
|
||||
fun:
|
||||
_type: ExprLambda
|
||||
arg: x
|
||||
body:
|
||||
_type: ExprVar
|
||||
value: x
|
||||
e:
|
||||
_type: ExprSet
|
||||
attrs:
|
||||
a:
|
||||
_type: ExprLiteral
|
||||
value: 2
|
||||
valueType: Int
|
||||
recursive: false
|
||||
@@ -0,0 +1,12 @@
|
||||
warning: using or as an identifier is deprecated because it cannot be used in most places (try let or = 1; in or). Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:9:3:
|
||||
8|
|
||||
9| or = x: y: x || y;
|
||||
| ^
|
||||
10|
|
||||
warning: using or as an argument is deprecated because it is parsed with the wrong precedence which may cause unexpected behavior. Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:23:11:
|
||||
22| # it short-circuits and never runs into the type error
|
||||
23| (fold or [] [true false false])
|
||||
| ^
|
||||
24| ]
|
||||
@@ -0,0 +1 @@
|
||||
with {}; or
|
||||
@@ -0,0 +1 @@
|
||||
let or = 1; in or
|
||||
@@ -0,0 +1,5 @@
|
||||
error: syntax error, expecting expression
|
||||
at /pwd/in.nix:1:10:
|
||||
1| with {}; or
|
||||
| ^
|
||||
2|
|
||||
@@ -0,0 +1,10 @@
|
||||
warning: using or as an identifier is deprecated because it cannot be used in most places (try let or = 1; in or). Use --extra-deprecated-features or-as-identifier to disable this warning.
|
||||
at /pwd/in.nix:1:5:
|
||||
1| let or = 1; in or
|
||||
| ^
|
||||
2|
|
||||
error: syntax error, expecting expression
|
||||
at /pwd/in.nix:1:16:
|
||||
1| let or = 1; in or
|
||||
| ^
|
||||
2|
|
||||
Reference in New Issue
Block a user