1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 07:31:15 +02:00

Introduce NormalType for the normal type of a Value

This will be useful to abstract over the ValueType implementation
details

Make use of it already to replace the showType(ValueType) function
This commit is contained in:
Silvan Mosberger 2020-12-11 23:32:45 +01:00
parent 9c143c411b
commit fa307875e9
No known key found for this signature in database
GPG key ID: E8F1E9EAD284E17D
5 changed files with 68 additions and 34 deletions

View file

@ -513,7 +513,7 @@ std::string AttrCursor::getString()
auto & v = forceValue();
if (v.type != tString && v.type != tPath)
throw TypeError("'%s' is not a string but %s", getAttrPathStr(), showType(v.type));
throw TypeError("'%s' is not a string but %s", getAttrPathStr(), showType(v.normalType()));
return v.type == tString ? v.string.s : v.path;
}
@ -548,7 +548,7 @@ string_t AttrCursor::getStringWithContext()
else if (v.type == tPath)
return {v.path, {}};
else
throw TypeError("'%s' is not a string but %s", getAttrPathStr(), showType(v.type));
throw TypeError("'%s' is not a string but %s", getAttrPathStr(), showType(v.normalType()));
}
bool AttrCursor::getBool()