From 649d388ff422a9a049e2b50768db357a73ee59d5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 2 Dec 2022 15:34:53 +0200 Subject: Fail if scope or target qualification in variable expansion is unknown There are three options here: we can "fall through" to an outer scope (there is always the global scope backstop; this is the old semantics, sort of), we can return NULL straight away, or we can fail. It feels like in most cases unknown scope or target is a mistake and doing anything other than failing is just making things harder to debug. --- tests/variable/override/testscript | 2 ++ .../variable/target-type-pattern-specific/testscript | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) (limited to 'tests/variable') diff --git a/tests/variable/override/testscript b/tests/variable/override/testscript index 9ee4643..7b973c0 100644 --- a/tests/variable/override/testscript +++ b/tests/variable/override/testscript @@ -63,6 +63,8 @@ p.x = 0 file{*}: p.x += a + file{foo}: + print $(file{foo}:p.x) p.x = 1 # Should invalidate both caches. diff --git a/tests/variable/target-type-pattern-specific/testscript b/tests/variable/target-type-pattern-specific/testscript index 016380b..9c600ca 100644 --- a/tests/variable/target-type-pattern-specific/testscript +++ b/tests/variable/target-type-pattern-specific/testscript @@ -12,6 +12,9 @@ x = x y = y dir{*}: x = X dir{*}: y += Y + +./: + print $(./: x) print $(./: y) EOI @@ -26,6 +29,7 @@ dir{*}: x = y x = z dir{*-foo}: x = $x # 'z' +bar-foo/: print $(bar-foo/: x) x = G @@ -59,6 +63,7 @@ print $(file{x-foz}: x) *: x1 = X1 {*}: x2 = X2 target{*}: x3 = X3 +file{x}: print $(file{x}: x1) print $(file{x}: x2) print $(file{x}: x3) @@ -89,6 +94,9 @@ dir{*}: y += Y z = $x # Note: from scope. } + +./: + print $(./: x) print $(./: y) print $(./: z) @@ -108,6 +116,9 @@ file{f*} file{b*}: x = X y += Y } + +file{foo bar}: + print $(file{foo}: x) print $(file{bar}: y) EOI @@ -123,6 +134,8 @@ EOO $* <>EOO file{~/'.+\.txt'/i}: x = 1 + file{foo.txt foo.TXT}: + print $(file{foo.txt}: x) print $(file{foo.TXT}: x) EOI @@ -140,6 +153,8 @@ EOO txt{~/'.+\.tx'/e}: x = 2 txt{~/'.+\.txt'/e}: x = 3 + txt{foo.x foo.tx foo.txt foo.bar...}: + print $(txt{foo.x}: x) print $(txt{foo.tx}: x) print $(txt{foo.txt}: x) @@ -157,6 +172,8 @@ EOO x = 0 file{~/'(.+)-\1'/}: x = 1 + file{foo-foo foo-bar}: + print $(file{foo-foo}: x) print $(file{foo-bar}: x) EOI @@ -169,6 +186,8 @@ EOO $* <>EOO foo/dir{~/b.+/}: x = 1 + foo/dir{bar}: + print $(foo/dir{bar}: x) EOI 1 -- cgit v1.1