public static TypeSpec Resolve(ModuleContainer module, MemberKind kind, string ns, string name, int arity, Location loc)
{
Namespace type_ns = module.GlobalRootNamespace.GetNamespace(ns, true);
var te = type_ns.LookupType(module, name, arity, false, Location.Null);
if (te == null)
{
module.Compiler.Report.Error(518, loc, "The predefined type `{0}.{1}' is not defined or imported", ns, name);
return(null);
}
var type = te.Type;
if (type.Kind != kind)
{
if (type.Kind == MemberKind.Struct && kind == MemberKind.Void && type.MemberDefinition is TypeContainer)
{
// Void is declared as struct but we keep it internally as
// special kind, the swap will be done by caller
}
else
{
module.Compiler.Report.Error(520, loc, "The predefined type `{0}.{1}' is not declared correctly", ns, name);
return(null);
}
}
return(type);
}