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

fix compilation with nix 2.25 #624

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
callPackage
stdenv
;
nix = nixVersions.nix_2_24;
nix = nixVersions.nix_2_25;
llvmPackages = llvmPackages_16;
nixf = callPackage ./libnixf { };
nixt = callPackage ./libnixt { inherit nix; };
Expand Down
2 changes: 1 addition & 1 deletion libnixt/test/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ TEST_F(ValueTest, selectAttrPath) {
nix::Value &Kern = selectStringViews(*State, Nested, {"c", "d"});

ASSERT_EQ(Kern.type(), nix::ValueType::nInt);
ASSERT_EQ(Kern.integer(), 1);
ASSERT_EQ(Kern.integer(), nix::NixInt{1});
}

} // namespace
8 changes: 4 additions & 4 deletions nixd/lib/Eval/AttrSetProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ std::optional<Location> locationOf(nix::PosTable &PTable, nix::Value &V) {
return std::nullopt;

Position LPos = {
.line = static_cast<int>(NixPos.line - 1),
.character = static_cast<int>(NixPos.column - 1),
.line = static_cast<int64_t>(NixPos.line - 1),
.character = static_cast<int64_t>(NixPos.column - 1),
};

return Location{
Expand Down Expand Up @@ -86,8 +86,8 @@ void fillUnsafeGetAttrPosLocation(nix::EvalState &State, nix::Value &V,
Column.type() == nix::ValueType::nInt) {

// Nix position starts from "1" however lsp starts from zero.
lspserver::Position Pos = {static_cast<int>(Line.integer()) - 1,
static_cast<int>(Column.integer()) - 1};
lspserver::Position Pos = {static_cast<int64_t>(Line.integer()) - 1,
static_cast<int64_t>(Column.integer()) - 1};
Loc.range = {Pos, Pos};
}
}
Expand Down
4 changes: 2 additions & 2 deletions nixd/lspserver/include/lspserver/Protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ bool fromJSON(const llvm::json::Value &, VersionedTextDocumentIdentifier &,

struct Position {
/// Line position in a document (zero-based).
int line = 0;
int64_t line = 0;

/// Character offset on a line in a document (zero-based).
/// WARNING: this is in UTF-16 codepoints, not bytes or characters!
/// Use the functions in SourceCode.h to construct/interpret Positions.
int character = 0;
int64_t character = 0;

friend bool operator==(const Position &LHS, const Position &RHS) {
return std::tie(LHS.line, LHS.character) ==
Expand Down