meowlang/typechecker/types/GenericFunctionTypeDescription.cs
Gwendolyn d6bdd08002 loooots of stuff
the typechecker project can collect all the top level types from a file, which is pretty cool I think
(except for pointers, those aren't implemented yet...)
2022-02-13 02:41:16 +01:00

21 lines
791 B
C#

namespace meowlang.typechecker;
public record GenericFunctionTypeDescription : GenericTypeDescription
{
private readonly List<GenericTypeId> _parameters;
private readonly List<GenericTypeId> _returns;
public GenericFunctionTypeDescription(List<string> genericNames, List<GenericTypeId> parameters, List<GenericTypeId> returns) : base(genericNames)
{
_parameters = parameters;
_returns = returns;
}
public override FunctionTypeDescription Concretize(List<Guid> typeParams)
{
var parameters = _parameters.Select(x => ConcretizeGenericType(x, typeParams)).ToList();
var returns = _returns.Select(x => ConcretizeGenericType(x, typeParams)).ToList();
return new FunctionTypeDescription(parameters, returns);
}
};