示例#1
0
	def check_type_sat(self, cons):
		# print (map(lambda c: str(c),cons))
		mus = min_unsat_subset(self.solver, cons)
		if len(mus) == 0:
			model = self.solver.solve(cons)
			for d in model:
				key = str(d)
				if key in self.infer_goals:
					smt_type = model[d]
					self.infer_goals[key].smt_type = smt_type
					self.infer_goals[key].type = coerce_type( smt_type )
					print "%s -> %s::%s" % (self.infer_goals[key], type_to_data_sort( model[d] ), self.infer_goals[key].type )
					del self.infer_goals[key]
			return True
		else:
			error_idx = self.declare_error("Type Error in the following sites")
			for error_site in foldl( map(lambda c: c.get_just(),mus), []):
				self.extend_error(error_idx, error_site)
			return False
示例#2
0
 def check_type_sat(self, cons):
     # print (map(lambda c: str(c),cons))
     mus = min_unsat_subset(self.solver, cons)
     if len(mus) == 0:
         model = self.solver.solve(cons)
         for d in model:
             key = str(d)
             if key in self.infer_goals:
                 smt_type = model[d]
                 self.infer_goals[key].smt_type = smt_type
                 self.infer_goals[key].type = coerce_type(smt_type)
                 print "%s -> %s::%s" % (self.infer_goals[key],
                                         type_to_data_sort(model[d]),
                                         self.infer_goals[key].type)
                 del self.infer_goals[key]
         return True
     else:
         error_idx = self.declare_error("Type Error in the following sites")
         for error_site in foldl(map(lambda c: c.get_just(), mus), []):
             self.extend_error(error_idx, error_site)
         return False
示例#3
0
文件: inspectors.py 项目: sllam/chrcp
	def get_base_facts(self, fact):
		return foldl(map(lambda f: self.get_base_facts(f), fact.facts), [])
示例#4
0
	def build_display_regions(self, ast_node):
		error_idxs = ast_node.error_idxs + foldl(map(lambda lf: self.build_display_regions(lf),ast_node.loc_facts),[])
		self.extend_display_regions(error_idxs,[(ast_node.lex_start,ast_node.lex_end)])
		return error_idxs
示例#5
0
	def build_display_regions(self, ast_node):
		error_idxs = ast_node.error_idxs + foldl(map(lambda v: self.build_display_regions(v),ast_node.exist_vars),[])
		self.extend_display_regions(error_idxs,[(ast_node.lex_start,ast_node.lex_end)])
		return error_idxs
示例#6
0
 def get_base_facts(self, fact):
     return foldl(map(lambda f: self.get_base_facts(f), fact.facts), [])
示例#7
0
	def build_display_regions(self, ast_node):
		error_idxs = ast_node.error_idxs + foldl(map(lambda lf: self.build_display_regions(lf),ast_node.loc_facts),[])
		self.extend_display_regions(error_idxs,[(ast_node.lex_start,ast_node.lex_end)])
		return error_idxs
示例#8
0
	def build_display_regions(self, ast_node):
		error_idxs = ast_node.error_idxs + foldl(map(lambda v: self.build_display_regions(v),ast_node.exist_vars),[])
		self.extend_display_regions(error_idxs,[(ast_node.lex_start,ast_node.lex_end)])
		return error_idxs
示例#9
0
文件: lhs_compre.py 项目: sllam/msre
	def getVars(self, fact):
		return foldl(map(lambda f: self.getVars(f), fact), [])