Auto-caller calls invalid functors #1057
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
awaiting
author
awaiting
contributors
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#1057
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
A valid1 functor is an attrset with a
__functorattribute, which is a function of typeAttrSet -> Any -> Any. However, in a case where someone writes an invalid one, where it’s a function that returns anything but a function, auto-caller will still call it, and resolve the value. Despite it being impossible in regular nix code.Steps To Reproduce
Given file:
We can observe:
Expected behavior
Either an error saying attrset is not a function, or auto-caller not being engaged and returning
hi from outside.nix --versionoutputnix (Lix, like Nix) 2.94.0-pre20251115-dev_243836e(still occurs on latest main)Additional context
Discussed on matrix. cc @piegames @raito
valid is defined by semantics of callFunction, as seen in
Value args2[] = {vCur, args[0]};↩︎
On the other hand, it doesn't autocall correct functors. What the fuck.
auto-calls should be removed entirely. there are multiple issues about how fundamentally broken this feature is, and even apart from that it is completely useless and counterproductive except for the
{ pkgs ? import <nixpkgs> {} }:header commonly seen in shell.nix files, which is better served by allowing functions with defaults for all structured args to be called exactly one level deep.