__curPos can be overwritten without warning, but cannot be used
Describe the bug
__curPos is a useful builtin in get the current position, e.g. for debugging purposes. However, due to its implementation, it can be overwritten without any warning, but can only be used in combination with the keyword inherit. If used directly, the builtin will always be used.
Steps To Reproduce
nix-repl> let __curPos = "Hello World"; in __curPos
{ column = 34; file = "let __curPos = \"Hello World\"; in __curPos"; line = 1; }
Expected behavior
Either a warning/error to prevent overwriting __curPos or, what I prefer, allow overwriting and implement it differently. Btw. the set should include an attribute _type = "position"; or something like that, similar to e.g. derivations.
nix-env --version output
Priorities
Add :+1: to issues you find important.
It should be documented as a keyword, not a builtin.
In 2.18, it really is a keyword and not a variable reference that adheres to scope rules etc.
In the repl, it evaluates to null now, which I'd consider to be a bug.
Welcome to Nix 2.18.1. Type :? for help.
nix-repl> let __curPos = "Hello World"; in __curPos
null