### Godot version

Godot 4 0160fea1ced6697d5b72ad2f41332e8768080be4

### System information

Windows 10 64 bits NVIDIA GeForce GTX 1060

### Issue description

The symptom of this in my project is the following:
```gdscript
not list.has(42)
```
Under particular runtime conditions, this code produces an error:
```
SCRIPT ERROR: Invalid operands 'bool' and 'int' in operator 'not'.
```
![image](https://user-images.githubusercontent.com/1311555/210856995-8f82630d-69a7-42ca-a18b-9fca29f5ec51.png)

When normally there is no reason for such code to cause this error, because `has` returns `bool`, and `not` takes only a `bool`.

After investigation, it turns out the GDScript VM ends up with two operands when executing the `NOT` operation: `bool` and `int`, instead of `bool` and `nil`.
The VM uses a special operand address for nil, but in this case, a non-nil value has been stored in it.
This behavior seems to have been introduced by this PR: https://github.com/godotengine/godot/pull/70702#issuecomment-1371704072

Thanks to @vonagam for investigating and confirming the in-game reproduction.

### Steps to reproduce

I was unable reproduce this in a simple project. It only happens in a big project, which is currently not open-source. However, the reproduction steps *in the game* are quick, and reliably cause the bug every time.

Just in case, below is a simplification of the impacted code that runs in the game when the issue occurs. This is what I tried as an MRP, unfortunately, it does not reproduce the issue alone, despite the affected data being relatively isolated. There are probably external implications which are hard to track down.
```gdscript
extends RigidBody3D

# custom RefCounted script
const BlockInstance = preload("./block_instance.gd")

# custom RefCounted script, with a `tags` array variable containing integers
const Block = preload("./block.gd")

var _dict := {}

func _ready():
	var block = Block.new()
	# The following instructions mimick a series of actions done in the game.

	var b0 = BlockInstance.new()
	
	var b1 = BlockInstance.new()
	add(b1, block)
	
	var b2 = BlockInstance.new()
	add(b2, block)
	
	remove(b1, block)
	b1 = null
	
	var b3 = BlockInstance.new()
	add(b3, block)


func add(bi: BlockInstance, block: Block):
	if len(block.tags) > 0:
		for tag in block.tags:
			var list = _dict.get(tag, null)
			if list == null:
				list = []
				_dict[tag] = list
			else:
				print("list is ", typeof(list))
				# This is where the error occurs at the last call to `add`
				assert(not list.has(bi))
			list.append(bi)


func remove(bi: BlockInstance, block):
	if len(block.tags) > 0:
		for tag in block.tags:
			var list = _dict[tag]
			list.erase(bi)
```

If you need to reproduce the issue, you can contact me.


### Minimal reproduction project

N.A
switch (err.error) {
					case Callable::CallError::CALL_ERROR_INVALID_ARGUMENT: {
						PropertyInfo wrong_arg = function_info.arguments[err.argument];
						push_error(vformat(R"*(Invalid argument for "%s()" function: argument %d should be %s but is %s.)*", function_name, err.argument + 1,
										   type_from_property(wrong_arg).to_string(), p_call->arguments[err.argument]->get_datatype().to_string()),
								p_call->arguments[err.argument]);
					} break;
					case Callable::CallError::CALL_ERROR_INVALID_METHOD:
						push_error(vformat(R"(Invalid call for function "%s".)", function_name), p_call);
						break;
					case Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS:
						push_error(vformat(R"*(Too many arguments for "%s()" call. Expected at most %d but received %d.)*", function_name, err.expected, p_call->arguments.size()), p_call);
						break;
					case Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS:
						push_error(vformat(R"*(Too few arguments for "%s()" call. Expected at least %d but received %d.)*", function_name, err.expected, p_call->arguments.size()), p_call);
						break;
					case Callable::CallError::CALL_ERROR_METHOD_NOT_CONST:
					case Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL:
						break; 
					case Callable::CallError::CALL_OK:
						p_call->is_constant = true;
						p_call->reduced_value = value;
						break;
				}
			} else {
				validate_call_arg(function_info, p_call);
			}
			p_call->set_datatype(type_from_property(function_info.return_val));
			return;
		} else if (Variant::has_utility_function(function_name)) {