Skip to content

feat: resolve let-in identifier patterns to their attrset bindings#154

Closed
Alb-O wants to merge 1 commit intonix-community:masterfrom
Alb-O:master
Closed

feat: resolve let-in identifier patterns to their attrset bindings#154
Alb-O wants to merge 1 commit intonix-community:masterfrom
Alb-O:master

Conversation

@Alb-O
Copy link

@Alb-O Alb-O commented Dec 3, 2025

Adds support for let ... in identifier patterns, where the body of a let-in expression is an identifier referencing an attrset binding

Motivation

Some Nix libraries define documented functions in let blocks and return them via an identifier:

let
  /** Doc comment */
  myFunc = x: x + 1;
  
  exports = { inherit myFunc; };
in
  exports

Previously, nixdoc couldn't extract documentation from these files because it only looked for attrsets directly in the let-in body, not identifier references to them.

Changes

  • Added find_let_binding() to locate an AttrpathValue binding by name in a let block
  • Added resolve_let_ident() to resolve identifiers with chained resolution support (e.g., alias = exports; in alias)
  • Updated collect_entries() to check if the let-in body is an identifier and resolve it before collecting bindings
  • Added tests for both direct and chained identifier resolution

@Alb-O Alb-O closed this Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant