'Cast a Numba IR variable to the given Numba type, returning a
low-level value.'

def _cast_var(self, var, ty):

    if isinstance(var, _VarArgItem):
        varty = self.typeof(var.vararg.name)[var.index]
        val = self.builder.extract_value(self.loadvar(var.vararg.name), var.index)
    else:
        varty = self.typeof(var.name)
        val = self.loadvar(var.name)
    return self.context.cast(self.builder, val, varty, ty)
