diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-08-29 10:25:40 +0200 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-08-31 23:01:21 +0200 |
commit | a6c9a151d3ce51d53fc7f34722a7422c3c0faff4 (patch) | |
tree | e8cee4bcfda408043acef70afe7a4905c84cee60 /mesonbuild/interpreterbase | |
parent | b60bd0e299460c436acba43de27ac52afb11026b (diff) | |
download | meson-a6c9a151d3ce51d53fc7f34722a7422c3c0faff4.zip meson-a6c9a151d3ce51d53fc7f34722a7422c3c0faff4.tar.gz meson-a6c9a151d3ce51d53fc7f34722a7422c3c0faff4.tar.bz2 |
interpreter: Make comparisons of different types a hard error
Diffstat (limited to 'mesonbuild/interpreterbase')
-rw-r--r-- | mesonbuild/interpreterbase/interpreterbase.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mesonbuild/interpreterbase/interpreterbase.py b/mesonbuild/interpreterbase/interpreterbase.py index 2fa77ee..289e1d7 100644 --- a/mesonbuild/interpreterbase/interpreterbase.py +++ b/mesonbuild/interpreterbase/interpreterbase.py @@ -47,6 +47,7 @@ from ._unholder import _unholder import os, copy, re, pathlib import typing as T +import textwrap if T.TYPE_CHECKING: from ..interpreter import Interpreter @@ -306,11 +307,14 @@ class InterpreterBase: valid = self.validate_comparison_types(val1, val2) # Ordering comparisons of different types isn't allowed since PR #1810 # (0.41.0). Since PR #2884 we also warn about equality comparisons of - # different types, which will one day become an error. + # different types, which is now an error. if not valid and (node.ctype == '==' or node.ctype == '!='): - mlog.warning('''Trying to compare values of different types ({}, {}) using {}. -The result of this is undefined and will become a hard error in a future Meson release.''' - .format(type(val1).__name__, type(val2).__name__, node.ctype), location=node) + raise InvalidArguments(textwrap.dedent( + f''' + Trying to compare values of different types ({type(val1).__name__}, {type(val2).__name__}) using {node.ctype}. + This was deprecated and undefined behavior previously and is as of 0.60.0 a hard error. + ''' + )) if node.ctype == '==': return val1 == val2 elif node.ctype == '!=': |