handle meson_version after parsing but before invalid project() kwargs
If we add new kwargs to a function invoked on the first line, we also need to validate the meson_version before erroring out due to unknown kwargs. Even if the AST was successfully built. Amusingly, we also get to improve the error message a bit. By passing the AST node instead of an interpreter node, we get not just line numbers, but also column offsets of the issueful meson_version. That broke the stdout of another failing test; adapt it.
This commit is contained in:
parent
878c1604e6
commit
314382d6ff
|
@ -117,6 +117,7 @@ class InterpreterBase:
|
|||
assert isinstance(code, str)
|
||||
try:
|
||||
self.ast = mparser.Parser(code, mesonfile).parse()
|
||||
self.handle_meson_version_from_ast()
|
||||
except mparser.ParseException as me:
|
||||
me.file = mesonfile
|
||||
# try to detect parser errors from new syntax added by future
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
project('invalid project function with bad kwargs', meson_version: '0.1.0', unknown_kwarg: 'val')
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"stdout": [
|
||||
{
|
||||
"match": "re",
|
||||
"line": "test cases/failing/131 invalid project function/meson.build:1:67: ERROR: Meson version is [0-9.]+ but project requires 0.1.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
"stdout": [
|
||||
{
|
||||
"match": "re",
|
||||
"line": "test cases/failing/20 version/meson\\.build:1:0: ERROR: Meson version is .* but project requires >100\\.0\\.0"
|
||||
"line": "test cases/failing/20 version/meson\\.build:1:44: ERROR: Meson version is .* but project requires >100\\.0\\.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue