Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libexpr: print value of what is attempted to be called as function #9818

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Jan 20, 2024

Motivation

Depends on #9753

This basically prints out what was attempted to be called as function,
i.e.

map (import {}) [ 1 2 3 ]

now gives the following error message:

error:
       … while calling the 'map' builtin
         at «string»:1:1:
            1| map (import <nixpkgs> {}) [ 1 2 3 ]
             | ^

       … while evaluating the first argument passed to builtins.map

       error: expected a function but found a set: { _type = "pkgs"; AAAAAASomeThingsFailToEvaluate = «thunk»; AMB-plugins = «thunk»; ArchiSteamFarm = «thunk»; BeatSaberModManager = «thunk»; CHOWTapeModel = «thunk»; ChowCentaur = «thunk»; ChowKick = «thunk»; ChowPhaser = «thunk»; CoinMP = «thunk»;  «18783 attributes elided»}

Remains a draft until #9753 (the parent of this PR) is merged.

Context

Low-hanging fruit in the spirit of #9753 and #9754 (means 9999years did
all the hard work already), but for

attempt to call something which is not a function but ...

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@github-actions github-actions bot added new-cli Relating to the "nix" command with-tests Issues related to testing. PRs with tests have some priority labels Jan 20, 2024
@cole-h
Copy link
Member

cole-h commented Jan 20, 2024

(very minor thing, but there is a dpulls action on this repository, so if you write Depends on #9753 in the PR body, the dpulls action should fail until that PR is merged, and then post a comment once that's happened, if you're interested)

Copy link

dpulls bot commented Jan 22, 2024

🎉 All dependencies have been resolved !

Low-hanging fruit in the spirit of NixOS#9753 and NixOS#9754 (means 9999years did
all the hard work already).

This basically prints out what was attempted to be called as function,
i.e.

  map (import <nixpkgs> {}) [ 1 2 3 ]

now gives the following error message:

    error:
           … while calling the 'map' builtin
             at «string»:1:1:
                1| map (import <nixpkgs> {}) [ 1 2 3 ]
                 | ^

           … while evaluating the first argument passed to builtins.map

           error: expected a function but found a set: { _type = "pkgs"; AAAAAASomeThingsFailToEvaluate = «thunk»; AMB-plugins = «thunk»; ArchiSteamFarm = «thunk»; BeatSaberModManager = «thunk»; CHOWTapeModel = «thunk»; ChowCentaur = «thunk»; ChowKick = «thunk»; ChowPhaser = «thunk»; CoinMP = «thunk»;  «18783 attributes elided»}
@Ma27 Ma27 force-pushed the print-value-on-function-call-type-error branch from 6d22d72 to 81499a0 Compare January 22, 2024 22:03
@Ma27 Ma27 marked this pull request as ready for review January 22, 2024 22:03
@Ma27 Ma27 requested a review from edolstra as a code owner January 22, 2024 22:03
@Ma27
Copy link
Member Author

Ma27 commented Jan 22, 2024

Rebased onto latest master with #9753 being resolved.
cc @roberth

@roberth roberth merged commit 50e5d7b into NixOS:master Jan 22, 2024
8 checks passed
@roberth
Copy link
Member

roberth commented Jan 22, 2024

Thanks!

@Ma27 Ma27 deleted the print-value-on-function-call-type-error branch January 23, 2024 06:57
tebowy pushed a commit to tebowy/nix that referenced this pull request Jul 11, 2024
…type-error

libexpr: print value of what is attempted to be called as function
(cherry picked from commit 50e5d7b)
Change-Id: I7cb6290bd8f244e83bfce3b2eed2a4c8b4f16a83
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-cli Relating to the "nix" command with-tests Issues related to testing. PRs with tests have some priority
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants