Invalid mappings can be created in the repl #1209

Open
opened 2026-05-06 15:51:57 +00:00 by tom-hubrecht · 1 comment
Member

Describe the bug

Invalid mappings can be added to the repl environment

Steps To Reproduce

  1. Open the repl with nix repl
  2. Declare "*" = x: y: x * y
  3. See Added "*".

Expected behavior

An error should be thrown if the mapping is an invalid identifier

nix --version output

nix (Lix, like Nix) 2.96.0-dev-010d0629261248ad846f9f12b356053514e464eb
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf

Additional context

Not a very grave bug, but a funny quirk that should be removed

## Describe the bug Invalid mappings can be added to the repl environment ## Steps To Reproduce 1. Open the repl with `nix repl` 2. Declare `"*" = x: y: x * y` 3. See `Added "*".` ## Expected behavior An error should be thrown if the mapping is an invalid identifier ## `nix --version` output nix (Lix, like Nix) 2.96.0-dev-010d0629261248ad846f9f12b356053514e464eb System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf ## Additional context Not a very grave bug, but a funny quirk that should be removed
Owner

not invalid. you can still access all of these bindings with inherits:

nix-repl> "*" = 1          
Added "*".

nix-repl> { inherit "*"; }
{ "*" = 1; }

the same is true for let blocks too, where the same thing is allowed for the same lazy grammar writing reasons :dragnupsidedown:

not invalid. you can still access all of these bindings with inherits: ``` nix-repl> "*" = 1 Added "*". nix-repl> { inherit "*"; } { "*" = 1; } ``` the same is true for `let` blocks too, where the same thing is allowed for the same lazy grammar writing reasons :dragnupsidedown:
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lix-project/lix#1209
No description provided.