def _refine_target_type(self, typeinfer, targetty, idxty, valty, sig):
        """Refine the target-type given the known index type and value type.
        """
        # For array setitem, refine imprecise array dtype
        if _is_array_not_precise(targetty):
            typeinfer.add_type(self.target.name, sig.args[0], loc=self.loc)
        # For Dict setitem
        if isinstance(targetty, types.DictType):
            if not targetty.is_precise():
                refined = targetty.refine(idxty, valty)
                typeinfer.add_type(
                    self.target.name, refined,
                    loc=self.loc,
                )
            elif isinstance(targetty, types.LiteralStrKeyDict):
                typeinfer.add_type(
                    self.target.name, types.DictType(idxty, valty),
                    loc=self.loc,
                )
Refine the target-type given the known index type and value type.
        
numba/core/typeinfer.py