diff --git a/mesonbuild/interpreter/primitives/integer.py b/mesonbuild/interpreter/primitives/integer.py index f433f5775..b7f353210 100644 --- a/mesonbuild/interpreter/primitives/integer.py +++ b/mesonbuild/interpreter/primitives/integer.py @@ -3,13 +3,8 @@ from __future__ import annotations from ...interpreterbase import ( - ObjectHolder, - MesonOperator, - typed_operator, - noKwargs, - noPosargs, - - InvalidArguments + FeatureBroken, InvalidArguments, MesonOperator, ObjectHolder, + noKwargs, noPosargs, typed_operator, ) import typing as T @@ -53,6 +48,13 @@ class IntegerHolder(ObjectHolder[int]): def display_name(self) -> str: return 'int' + def operator_call(self, operator: MesonOperator, other: TYPE_var) -> TYPE_var: + if isinstance(other, bool): + FeatureBroken.single_use('int operations with non-int', '1.2.0', self.subproject, + 'It is not commutative and only worked because of leaky Python abstractions.', + location=self.current_node) + return super().operator_call(operator, other) + @noKwargs @noPosargs def is_even_method(self, args: T.List[TYPE_var], kwargs: TYPE_kwargs) -> bool: