This commit is contained in:
Daniel Kirchner 2023-06-25 09:03:15 +02:00
parent 2e9b844d65
commit 48b35bd921
2 changed files with 8 additions and 3 deletions

View File

@ -117,8 +117,7 @@ private:
friend class TypeSystem; friend class TypeSystem;
size_t m_index = 0; size_t m_index = 0;
Sort m_sort; Sort m_sort;
TypeVariable(size_t _index, Sort _sort): TypeVariable(size_t _index, Sort _sort): m_index(_index), m_sort(std::move(_sort)) {}
m_index(_index), m_sort(std::move(_sort)) {}
}; };
} }

View File

@ -398,7 +398,13 @@ std::string TypeEnvironmentHelpers::typeToString(Type const& _type) const
}, },
[](TypeVariable const& _type) { [](TypeVariable const& _type) {
std::stringstream stream; std::stringstream stream;
stream << "'var" << _type.index(); std::string varName;
size_t index = _type.index();
varName += 'a' + static_cast<char>(index%26);
while (index /= 26)
varName += 'a' + static_cast<char>(index%26);
reverse(varName.begin(), varName.end());
stream << '\'' << varName;
switch (_type.sort().classes.size()) switch (_type.sort().classes.size())
{ {
case 0: case 0: