aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreterbase.py
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2017-05-17 22:00:02 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2017-05-17 22:00:02 -0400
commit0e56ec2dbdbbd463d608c42e0aa117357e18936a (patch)
tree3c19b47d65c2ed55748ecc88fb3b1496db6e8efd /mesonbuild/interpreterbase.py
parentb36513a5b68fa4e34fbbf827a8704e0dc9d25f54 (diff)
downloadmeson-0e56ec2dbdbbd463d608c42e0aa117357e18936a.zip
meson-0e56ec2dbdbbd463d608c42e0aa117357e18936a.tar.gz
meson-0e56ec2dbdbbd463d608c42e0aa117357e18936a.tar.bz2
Don't allow non-equality comparisons across types.
Diffstat (limited to 'mesonbuild/interpreterbase.py')
-rw-r--r--mesonbuild/interpreterbase.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py
index 8b951b3..fb87ea2 100644
--- a/mesonbuild/interpreterbase.py
+++ b/mesonbuild/interpreterbase.py
@@ -221,6 +221,11 @@ class InterpreterBase:
return val1 == val2
elif node.ctype == '!=':
return val1 != val2
+ elif not isinstance(val1, type(val2)):
+ raise InterpreterException(
+ 'Values of different types ({}, {}) cannot be compared using {}.'.format(type(val1).__name__,
+ type(val2).__name__,
+ node.ctype))
elif not self.is_elementary_type(val1):
raise InterpreterException('{} can only be compared for equality.'.format(node.left.value))
elif not self.is_elementary_type(val2):