Skip to content

Commit

Permalink
flake: update the lock (#359)
Browse files Browse the repository at this point in the history
Fixes: #357
  • Loading branch information
inclyc authored Mar 11, 2024
2 parents 548226e + 2a6d140 commit eb40e5b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 47 deletions.
18 changes: 9 additions & 9 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 @@ -12,7 +12,7 @@
perSystem = { config, self', inputs', pkgs, system, ... }:
with pkgs;
let
nix = nixVersions.nix_2_16;
nix = nixVersions.nix_2_19;
llvmPackages = llvmPackages_16;
nixd = callPackage ./default.nix {
inherit nix;
Expand Down
9 changes: 0 additions & 9 deletions libnixt/lib/Deserialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ class ASTDecoder {
return create<nix::ExprString>(eat<std::string>());
}

nix::ExprPath *decodeExprPath() {
return create<nix::ExprPath>(eat<nix::Path>());
}

nix::ExprVar *decodeExprVar() {
auto Pos = decodePosIdx();
auto Name = decodeSymbol();
Expand All @@ -76,8 +72,6 @@ class ASTDecoder {
return decodeExprFloat();
case EncodeKind::ExprString:
return decodeExprString();
case EncodeKind::ExprPath:
return decodeExprPath();
case EncodeKind::ExprVar:
return decodeExprVar();
default:
Expand Down Expand Up @@ -112,9 +106,6 @@ template <> nix::Pos::Origin consume<nix::Pos::Origin>(BytesRef &Data) {
case 2:
return nix::Pos::Stdin{nix::make_ref<std::string>("")};
break;
case 3:
return nix::CanonPath(consume<std::string>(Data));
break;
default:
assert(false && "Unknown origin");
break;
Expand Down
4 changes: 2 additions & 2 deletions libnixt/lib/Serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ class ASTEncoder {
void encodeExprInt(const nix::ExprInt *E) {
assert(E);
ExprMap[E] = encode(OS, EncodeKind::ExprInt);
encode(OS, E->n);
encode(OS, E->v.integer);
}

void encodeExprFloat(const nix::ExprFloat *E) {
assert(E);
ExprMap[E] = encode(OS, EncodeKind::ExprFloat);
encode(OS, E->nf);
encode(OS, E->v.fpoint);
}

void encodeExprString(const nix::ExprString *E) {
Expand Down
11 changes: 2 additions & 9 deletions libnixt/test/Deserialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ void checkEmpty(BytesRef &Data) { EXPECT_EQ(lengthof(Data), 0); }
TEST_F(DeserializeTest, ExprInt) {
auto Data = encode(mkInt(0xdeadbeef).get());
auto *E = consumeAST(Data, Pool, PT, ST);
EXPECT_EQ(static_cast<nix::ExprInt *>(E)->n, 0xdeadbeef);
EXPECT_EQ(static_cast<nix::ExprInt *>(E)->v.integer, 0xdeadbeef);
checkEmpty(Data);
}

TEST_F(DeserializeTest, ExprFloat) {
auto Data = encode(new nix::ExprFloat{3.14});
auto *E = consumeAST(Data, Pool, PT, ST);
EXPECT_EQ(static_cast<nix::ExprFloat *>(E)->nf, 3.14);
EXPECT_EQ(static_cast<nix::ExprFloat *>(E)->v.fpoint, 3.14);
checkEmpty(Data);
}

Expand All @@ -62,13 +62,6 @@ TEST_F(DeserializeTest, ExprString) {
checkEmpty(Data);
}

TEST_F(DeserializeTest, ExprPath) {
auto Data = encode(new nix::ExprPath{"hello"});
auto *E = consumeAST(Data, Pool, PT, ST);
EXPECT_EQ(static_cast<nix::ExprPath *>(E)->s, "hello"s);
checkEmpty(Data);
}

TEST_F(DeserializeTest, ExprVar) {
auto EV = std::make_unique<nix::ExprVar>(somePos(), ST.create("hello"));
EV->level = 43;
Expand Down
17 changes: 0 additions & 17 deletions libnixt/test/Serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ TEST_F(SerializeTest, Origin_String) {
checkEmpty(Data);
}

TEST_F(SerializeTest, Origin_Path) {
auto Data = encode(nix::CanonPath("/"));
check(Data, (std::size_t)3);
check(Data, "/"s);
checkEmpty(Data);
}

TEST_F(SerializeTest, ExprInt) {
auto Data = encode(mkInt(0xdeadbeef).get());
checkASTHeader(Data);
Expand Down Expand Up @@ -126,16 +119,6 @@ TEST_F(SerializeTest, ExprString) {
checkEmpty(Data);
}

TEST_F(SerializeTest, ExprPath) {
auto EP = std::make_unique<nix::ExprPath>(nix::Path{"hello"});
auto Data = encode(EP.get());
checkASTHeader(Data);
checkTrivialOrigin(Data);
check(Data, EncodeKind::ExprPath);
check(Data, "hello"s);
checkEmpty(Data);
}

TEST_F(SerializeTest, ExprVar) {
auto EV = std::make_unique<nix::ExprVar>(somePos(), ST.create("hello"));
EV->level = 43;
Expand Down

0 comments on commit eb40e5b

Please sign in to comment.