Query_Statement::to_string() in src/overpass_api/statements/query.h:100-101 returns "nwr" for the nw type mask:
else if (type == (QUERY_NODE | QUERY_WAY | QUERY_RELATION))
return "nwr";
else if (type == (QUERY_NODE | QUERY_WAY))
return "nwr"; // should be "nw"
wr and nr are handled correctly; only nw is incorrect.
to_string() backs dump_compact_ql() and dump_pretty_ql() via dump_subquery_map_ql(), so the QL dump forms misreport the type. XML dumps are not affected.
Impact: Only query dumps are incorrect. Execution is unaffected — type holds the correct bitmask and only the echoed-back text is wrong. The dumped query with nwr in place of nw is still valid, but it is a different query that also returns relations.
Reproduce (verified against v0.7.62.11):
echo 'nw[amenity=cafe];' | osm3s_query --dump-compact-ql
Expected nw["amenity"="cafe"]; but output is nwr["amenity"="cafe"];. Same under --dump-pretty-ql and --dump-bbox-ql. The output with --dump-xml is correct.
Reproduces from XML input as well, so it is the dump side, not the parser:
osm3s_query --dump-compact-ql 2>/dev/null <<'EOF'
<osm-script>
<query type="nw"><has-kv k="amenity" v="cafe"/></query>
</osm-script>
EOF
Expected nw["amenity"="cafe"]; but output is nwr["amenity"="cafe"];
Fix: return "nw" on the type == (QUERY_NODE | QUERY_WAY) branch.
Version: present since the shortcuts were introduced in v0.7.56.1 (2020-03-03) and unchanged through v0.7.62.11.
Query_Statement::to_string()insrc/overpass_api/statements/query.h:100-101returns "nwr" for thenwtype mask:wrandnrare handled correctly; onlynwis incorrect.to_string()backsdump_compact_ql()anddump_pretty_ql()viadump_subquery_map_ql(), so the QL dump forms misreport the type. XML dumps are not affected.Impact: Only query dumps are incorrect. Execution is unaffected —
typeholds the correct bitmask and only the echoed-back text is wrong. The dumped query withnwrin place ofnwis still valid, but it is a different query that also returns relations.Reproduce (verified against v0.7.62.11):
Expected
nw["amenity"="cafe"];but output isnwr["amenity"="cafe"];. Same under--dump-pretty-qland--dump-bbox-ql. The output with--dump-xmlis correct.Reproduces from XML input as well, so it is the dump side, not the parser:
Expected
nw["amenity"="cafe"];but output isnwr["amenity"="cafe"];Fix: return "nw" on the
type == (QUERY_NODE | QUERY_WAY)branch.Version: present since the shortcuts were introduced in v0.7.56.1 (2020-03-03) and unchanged through v0.7.62.11.