Skip to content

Assertion error when a recursively used expression with a let binding is deleted #690

@sadan4

Description

@sadan4

Describe the bug
A clear and concise description of what the bug is.

Logs (Required)

relevant bit

nixd: ../src/Sema/VariableLookup.cpp:66: nixf::VariableLookupAnalysis::emitEnvLivenessWarning(const std::shared_ptr<nixf::EnvNode>&)::<lambda()>: Assertion `false && \"liveness diagnostic encountered an unknown source!\"' failed.\n
[START][2025-05-19 19:31:56] LSP logging initiated
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.130] 154604: <-- initialize(1)\nI[19:31:56.130] 154604: --> reply:initialize(1)\nI[19:31:56.131] 154604: --> call window/workDoneProgress/create(1)\nI[19:31:56.131] 154604: --> notify $/progress\nI[19:31:56.131] 154604: --> call attrset/evalExpr(1)\nI[19:31:56.131] 154604: --> call window/workDoneProgress/create(2)\nI[19:31:56.131] 154604: --> notify $/progress\nI[19:31:56.131] 154604: --> call attrset/evalExpr(1)\nI[19:31:56.131] 154604: --> call workspace/configuration(3)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.141] 154604: <-- initialized\nI[19:31:56.141] 154604: <-- workspace/didChangeConfiguration\nI[19:31:56.141] 154604: --> call workspace/configuration(4)\nI[19:31:56.141] 154604: <-- textDocument/didOpen\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.141] 154604: --> notify textDocument/publishDiagnostics\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.141] 154604: <-- reply(1)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.141] 154604: <-- reply(2)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.141] 154604: <-- reply(3)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.141] 154604: --> call window/workDoneProgress/create(5)\nI[19:31:56.141] 154604: --> notify $/progress\nI[19:31:56.141] 154604: --> call attrset/evalExpr(2)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.142] 154604: --> call window/workDoneProgress/create(6)\nI[19:31:56.142] 154604: --> notify $/progress\nI[19:31:56.142] 154604: --> call attrset/evalExpr(1)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.143] 154604: --> call window/workDoneProgress/create(7)\nI[19:31:56.143] 154604: --> notify $/progress\nI[19:31:56.143] 154604: --> call attrset/evalExpr(1)\nI[19:31:56.143] 154604: --> call window/workDoneProgress/create(8)\nI[19:31:56.143] 154604: --> notify $/progress\nI[19:31:56.143] 154604: --> call attrset/evalExpr(2)\nI[19:31:56.143] 154604: --> notify textDocument/publishDiagnostics\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.147] 154604: <-- textDocument/semanticTokens/full(2)\nI[19:31:56.147] 154604: --> reply:textDocument/semanticTokens/full(2)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.147] 154604: <-- reply(4)\nI[19:31:56.147] 154604: --> call window/workDoneProgress/create(9)\nI[19:31:56.147] 154604: --> notify $/progress\nI[19:31:56.147] 154604: --> call attrset/evalExpr(3)\nI[19:31:56.147] 154604: --> call window/workDoneProgress/create(10)\nI[19:31:56.147] 154604: --> notify $/progress\nI[19:31:56.147] 154604: --> call attrset/evalExpr(2)\nI[19:31:56.147] 154604: --> call window/workDoneProgress/create(11)\nI[19:31:56.147] 154604: --> notify $/progress\nI[19:31:56.147] 154604: --> call attrset/evalExpr(2)\nI[19:31:56.147] 154604: --> call window/workDoneProgress/create(12)\nI[19:31:56.147] 154604: --> notify $/progress\nI[19:31:56.147] 154604: --> call attrset/evalExpr(3)"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"\nI[19:31:56.147] 154604: --> notify textDocument/publishDiagnostics\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.147] 154604: <-- reply(5)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.147] 154604: <-- reply(6)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.148] 154604: <-- reply(7)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.148] 154604: <-- reply(8)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.148] 154604: <-- reply(9)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.148] 154604: <-- reply(10)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.148] 154604: <-- reply(11)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.148] 154604: <-- reply(12)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.287] 154604: <-- reply(1)\nI[19:31:56.287] 154604: --> notify $/progress\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.331] 154604: <-- reply(2)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.331] 154604: --> notify $/progress\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.375] 154604: <-- reply(3)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.375] 154604: --> notify $/progress\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.628] 154604: <-- reply(1)\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.628] 154604: --> notify $/progress\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.661] 154604: "
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"<-- reply(1)\nI[19:31:56.661] 154604: --> notify $/progress\n"
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:56.971] 154604: <-- reply("
[ERROR][2025-05-19 19:31:56] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"1)\nI[19:31:56.971] 154604: --> notify $/progress\n"
[ERROR][2025-05-19 19:31:57] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:57.017] 154604: <-- reply(2)\nI[19:31:57.017] 154604: --> notify $/progress\n"
[ERROR][2025-05-19 19:31:57] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:57.094] 154604: <-- reply(2)\n"
[ERROR][2025-05-19 19:31:57] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:57.094] 154604: --> notify $/progress\nE[19:31:57.094] 154604: nixos eval expr: -32001: attribute '\27[35;1mmodules\27[0m' missing\n"
[ERROR][2025-05-19 19:31:57] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:57.502] 154604: <-- reply(3)\nI[19:31:57.502] 154604: --> notify $/progress\nE[19:31:57.502] 154604: nixos eval expr: -32001: attribute '\27[35;1mmodules\27[0m' missing\n"
[ERROR][2025-05-19 19:31:57] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:31:57.665] 154604: <-- reply(2)\nI[19:31:57.665] 154604: --> notify $/progress\n"
[ERROR][2025-05-19 19:32:02] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"I[19:32:02.124] 154604: <-- textDocument/didChange\n"
[ERROR][2025-05-19 19:32:02] .../vim/lsp/rpc.lua:770	"rpc"	"/etc/profiles/per-user/meyer/bin/nixd"	"stderr"	"nixd: ../src/Sema/VariableLookup.cpp:66: nixf::VariableLookupAnalysis::emitEnvLivenessWarning(const std::shared_ptr<nixf::EnvNode>&)::<lambda()>: Assertion `false && \"liveness diagnostic encountered an unknown source!\"' failed.\n"

Configuration

I can reproduce this using nix develop github:nix-community/nixd#nvim

To Reproduce

using

rec {
  a = {
    bar = "${b}";
  };
  b =
    let
      foo = 2;
    in
    foo;
}

Steps to reproduce the behavior:

  1. delete line 7 (foo = 2;)
  2. notice an assertion error

Expected behavior
no assertion error

Screenshots

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions