Skip to content

Commit

Permalink
fix compilation with nix 2.25 (#624)
Browse files Browse the repository at this point in the history
Co-authored-by: Yingchi Long <[email protected]>
  • Loading branch information
Mic92 and inclyc authored Nov 28, 2024
1 parent 5507bb1 commit f12e2f7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
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

0 comments on commit f12e2f7

Please sign in to comment.