d6bdd08002
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...)
21 lines
791 B
C#
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);
|
|
}
|
|
}; |