This commit is contained in:
Daniel Kirchner 2023-06-25 08:48:48 +02:00
parent 58b7344c5a
commit 2e9b844d65
3 changed files with 4 additions and 9 deletions

View File

@ -104,12 +104,7 @@ private:
GlobalAnnotation& annotation();
void unify(Type _a, Type _b, langutil::SourceLocation _location = {}, TypeEnvironment* _env = nullptr);
enum class ExpressionContext
{
Term,
Type,
Sort
};
enum class ExpressionContext { Term, Type, Sort };
Type handleIdentifierByReferencedDeclaration(langutil::SourceLocation _location, Declaration const& _declaration);
ExpressionContext m_expressionContext = ExpressionContext::Term;
};

View File

@ -289,15 +289,14 @@ std::string TypeEnvironmentHelpers::canonicalTypeName(Type _type) const
};
std::visit(util::GenericVisitor{
[&](Declaration const* _declaration) {
printTypeArguments();
if (auto const* typeDeclarationAnnotation = dynamic_cast<TypeDeclarationAnnotation const*>(&_declaration->annotation()))
stream << *typeDeclarationAnnotation->canonicalName;
else
// TODO: canonical name
stream << _declaration->name();
printTypeArguments();
},
[&](BuiltinType _builtinType) {
printTypeArguments();
switch(_builtinType)
{
case BuiltinType::Type:
@ -331,6 +330,7 @@ std::string TypeEnvironmentHelpers::canonicalTypeName(Type _type) const
stream << "integer";
break;
}
printTypeArguments();
}
}, _type.constructor);
return stream.str();

View File

@ -1822,12 +1822,12 @@ ASTPointer<TypeClassInstantiation> Parser::parseTypeClassInstantiation()
expectToken(Token::Instantiation);
// TODO: parseTypeConstructor()
ASTPointer<TypeName> typeConstructor = parseTypeName();
expectToken(Token::Colon);
ASTPointer<ParameterList> argumentSorts;
if (m_scanner->currentToken() == Token::LParen)
{
argumentSorts = parseParameterList();
}
expectToken(Token::Colon);
ASTPointer<TypeClassName> typeClassName = parseTypeClassName();
expectToken(Token::LBrace);
while (true)