1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

Allow open switch-enum in 5 places

This commit is contained in:
Robert Hensing 2023-04-03 18:15:12 +02:00
parent 3dac4c7874
commit 9470ee877d
4 changed files with 21 additions and 0 deletions

View file

@ -577,6 +577,9 @@ struct CompareValues
return v1->integer < v2->fpoint;
if (v1->type() != v2->type())
state.error("cannot compare %s with %s", showType(*v1), showType(*v2)).debugThrow<EvalError>();
// Allow selecting a subset of enum values
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-enum"
switch (v1->type()) {
case nInt:
return v1->integer < v2->integer;
@ -599,6 +602,7 @@ struct CompareValues
}
default:
state.error("cannot compare %s with %s; values of that type are incomparable", showType(*v1), showType(*v2)).debugThrow<EvalError>();
#pragma GCC diagnostic pop
}
} catch (Error & e) {
if (!errorCtx.empty())