private TypeExpr MapNameToType(Dictionary <string, TypeExpr> env, TyQName nm) { var name = nm.QName_.ToString(); env.TryGetValue(name, out var result); result = result ?? (result = FindTypeofCtorName(name)); if (result == null) { throw new SemanticException($"Type Constructor {name} not found", nm._lexLocation); } return(result); }
private TypeCtorSig(ParsingContext ctx, string name, string[] pList, LexLocation lexLocation) { Name = name; ParamList = pList; Loc = lexLocation; _definingTypeAsTyExpr = TyQName.Create(Name, Loc, ctx); if (ParamList.Length > 0) { ListTypeExpr pLst = new ListTypeExpr(); foreach (var pNm in ParamList) { //TODO improve location of parameter pLst.AddLast(TyQName.Create(pNm, Loc, ctx)); } _definingTypeAsTyExpr = new TyApp(_definingTypeAsTyExpr, pLst, Loc, ctx); } }
private TypeExpr DefiningCtorAsShape() { var bTy = TyQName.Create(_definingCtor.Name, _definingCtor.Loc, this); if (_definingCtor.ParamList.Length <= 0) { return(bTy); } var pLst = new ListTypeExpr(); foreach (var pNm in _definingCtor.ParamList) { pLst.AddLast(new MetaTypVar(this)); } bTy = new TyApp(bTy, pLst, _definingCtor.Loc, this); return(bTy); }