TypeVar.lock() should check if it's already locked

I am trying to compile this function:

@udf(IntVal(FunctionContext, IntVal))
def test_impala_1(context, a):
    return None

infer.seed_return(IntVal) locks the TypeVar to IntVal, which is good.  However, when infer.build_constrain() is executed, it will see that the associated block should return a none type, and will lock it as none instead.  This seems like it might be a bug to me, because now we've lost the explicit return type information.
Finished numeric values, possible, including handling NULL and literals