def isListType(self, t): return util.isListType(t, self.world.symList)
result = Concat(e) result.elements = map(self.handleExp, e.children) type = BottomType() for i in range(len(result.elements)): el = result.elements[i] #don't insert cons cells, better to promote in typing #if not self.isListType(el.type(self.world.symList)): # #insert a list constructor # result.elements[i] = Cons(el) # el = result.elements[i] if el.type(self.world.symList).isSuperType(type, self.world.symList): continue elif type.isSuperType(el.type(self.world.symList), self.world.symList): type = el.type(self.world.symList) if not util.isListType(type, self.world.symList): temp = type type = List(None) type.arg = temp else: self.addErr("Incompatible type in concatenation: " + ppExp(e) + ", found: " + el.type(self.world.symList).shortString(), el.ast) result.typeF = type return result elif e.subtype == "subst": result = Subst(e) result.lhs = self.handleExp(e.lhs) result.rhs = self.handleExp(e.rhs) result.body = self.handleExp(e.val) lhsType = result.lhs.type(self.world.symList) if isinstance(result.rhs, List): if not isinstance(result.lhs, List):
result.elements = map(self.handleExp, e.children) type = BottomType() for i in range(len(result.elements)): el = result.elements[i] #don't insert cons cells, better to promote in typing #if not self.isListType(el.type(self.world.symList)): # #insert a list constructor # result.elements[i] = Cons(el) # el = result.elements[i] if el.type(self.world.symList).isSuperType( type, self.world.symList): continue elif type.isSuperType(el.type(self.world.symList), self.world.symList): type = el.type(self.world.symList) if not util.isListType(type, self.world.symList): temp = type type = List(None) type.arg = temp else: self.addErr( "Incompatible type in concatenation: " + ppExp(e) + ", found: " + el.type(self.world.symList).shortString(), el.ast) result.typeF = type return result elif e.subtype == "subst": result = Subst(e) result.lhs = self.handleExp(e.lhs) result.rhs = self.handleExp(e.rhs) result.body = self.handleExp(e.val)