You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
The in expression operator added in #16162 can only be used with paint and layout properties, not with layer filters. To reproduce, load this style and observe that nothing is visible:
mbgl::style::conversion::isExpression() always returns false for the filter ["in", "#", ["get", "color"]], because in is also a legacy filter operator:
mbgl::style::conversion::isExpression() does have some code to distinguish some expression operators from identically named filters, but in with two parameters might not be possible to resolve through static type checking. For example, ["in", "a", "abc"] has two equally valid interpretations:
Filter: Is the a property equal to “abc”?
Expression: Is the string “a” a substring of “abc”?
To avoid breaking backwards compatibility with existing styles, we’d have to interpret it as a filter, but that would prevent us from fixing this issue and fully supporting mapbox/mapbox-gl-js#4113.
This is a contrived case, to be sure: it’s more likely for the filter to be written ["==", "a", "abc"], and there’s no practical reason for someone to test whether a literal string is in a literal string. But nothing would’ve stopped someone from using in instead of == back before Studio launched expression support. And isExpression() relies on static type checking, which means it doesn’t know whether a is a string literal or a reference to a feature property.
The
in
expression operator added in #16162 can only be used with paint and layout properties, not with layer filters. To reproduce, load this style and observe that nothing is visible:colors.json
mbgl::style::conversion::isExpression()
always returns false for the filter["in", "#", ["get", "color"]]
, becausein
is also a legacy filter operator:mapbox-gl-native/src/mbgl/style/conversion/filter.cpp
Lines 56 to 57 in 305df25
/ref mapbox/mapbox-gl-native-ios#183 (comment)
/cc @jmkiley @Chaoba @chloekraw
The text was updated successfully, but these errors were encountered: