From e19095ef128f53644bc7650094d8924633c79efa Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 23 Nov 2016 16:53:31 +0200 Subject: Implement value type propagation on expansion Currently, we only propagate types of sole, unquoted expansions (variable, function call, or eval context), similar to NULL. To untypify the value, simply quote it. --- tests/expansion/buildfile | 7 ++++++ tests/expansion/common.test | 11 ++++++++++ tests/expansion/type.test | 53 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 tests/expansion/buildfile create mode 100644 tests/expansion/common.test create mode 100644 tests/expansion/type.test (limited to 'tests/expansion') diff --git a/tests/expansion/buildfile b/tests/expansion/buildfile new file mode 100644 index 0000000..81df59e --- /dev/null +++ b/tests/expansion/buildfile @@ -0,0 +1,7 @@ +# file : tests/expansion/buildfile +# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +./: test{type} file{common.test} + +test{*}: test = $effect($build.path) diff --git a/tests/expansion/common.test b/tests/expansion/common.test new file mode 100644 index 0000000..881c74e --- /dev/null +++ b/tests/expansion/common.test @@ -0,0 +1,11 @@ +# file : tests/expansion/assert.test +# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + ++mkdir build ++cat <>>build/bootstrap.build +project = test +amalgamation = +EOI + +test.options += -q --buildfile - noop diff --git a/tests/expansion/type.test b/tests/expansion/type.test new file mode 100644 index 0000000..1aae5b6 --- /dev/null +++ b/tests/expansion/type.test @@ -0,0 +1,53 @@ +# file : tests/expansion/type.test +# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +# Test type propagation during expansion. + +.include common.test + +: var +: +$* <>EOE != 0 +:1:7: error: conflicting attribute type bool and value type string + info: use quoting to untypify the value +EOE + +: retypify +: +$* <'print [bool] "([string] true)"' >'true' + +: retypify-name +: Test the "steal" case of untypify() +: +$* <'print [bool] "([name] true)"' >'true' -- cgit v1.1