fix(kernel/type_checker): avoid assertion violation due to API misuse

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
test(lua): add more tests for type checker

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>