diff --git a/src/style-spec/expression/definitions/curve.js b/src/style-spec/expression/definitions/curve.js index 354ec5287e6..e7e6314b9bf 100644 --- a/src/style-spec/expression/definitions/curve.js +++ b/src/style-spec/expression/definitions/curve.js @@ -140,7 +140,12 @@ class Curve implements Expression { if (interpolation.name !== 'step' && outputType.kind !== 'number' && outputType.kind !== 'color' && - !(outputType.kind === 'array' && outputType.itemType.kind === 'number')) { + !( + outputType.kind === 'array' && + outputType.itemType.kind === 'number' && + typeof outputType.N === 'number' + ) + ) { return context.error(`Type ${toString(outputType)} is not interpolatable, and thus cannot be used as a ${interpolation.name} curve's output type.`); } diff --git a/test/integration/expression-tests/curve/exponential-uninterpolatable-array/test.json b/test/integration/expression-tests/curve/exponential-string-array/test.json similarity index 100% rename from test/integration/expression-tests/curve/exponential-uninterpolatable-array/test.json rename to test/integration/expression-tests/curve/exponential-string-array/test.json diff --git a/test/integration/expression-tests/curve/exponential-uninterpolatable-numeric-array/test.json b/test/integration/expression-tests/curve/exponential-uninterpolatable-numeric-array/test.json new file mode 100644 index 00000000000..c67eb550aea --- /dev/null +++ b/test/integration/expression-tests/curve/exponential-uninterpolatable-numeric-array/test.json @@ -0,0 +1,23 @@ +{ + "expression": [ + "curve", + ["exponential", 2], + ["number", ["get", "x"]], + 1, + ["array", "number", ["get", "array"]], + 3, + ["array", "number", ["get", "array_two"]] + ], + "inputs": [], + "expected": { + "compiled": { + "result": "error", + "errors": [ + { + "key": "", + "error": "Type array is not interpolatable, and thus cannot be used as a exponential curve's output type." + } + ] + } + } +}