Modify

Opened 6 years ago

Last modified 6 years ago

#15726 new enhancement

Not returning the value when using tag()

Reported by: naoliv Owned by: team
Priority: normal Milestone:
Component: Core validator Version:
Keywords: mapcss Cc:

Description

Have this small validation rule:

*[foo = bar] {
        throwWarning: tr("something {0}={1}", "{0.key}", tag("{0.key}"));
}

and validate an object with foo=bar
We can see a message saying something foo=null

Of course the common usage is {0.value} instead tag("{0.key}"), but since tag(key_name) description says "get the value of the key key_name from the object in question", shouldn't we see the same result regardless which one we choose here?

JOSM:

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2018-01-02 00:31:23 +0100 (Tue, 02 Jan 2018)
Revision:13271
Build-Date:2018-01-02 02:33:50
URL:http://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (13271 pt_BR) Linux Debian GNU/Linux unstable (sid)
Memory Usage: 576 MB / 5120 MB (173 MB allocated, but free)
Java version: 9.0.1+11-Debian-1, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: :0.0 1920x1080
Maximum Screen Size: 1920x1080
Java package: openjdk-9-jre:amd64-9.0.1+11-1
Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-13
VM arguments: [--illegal-access=warn, --add-modules=java.se.ee, -Dawt.useSystemAAFontSettings=on]
Dataset consistency test: No problems found

Attachments (0)

Change History (3)

comment:1 by naoliv, 6 years ago

As a real example (and for context), I was trying to test some rules for #15719:

*[distance =~ /^[0-9]+,[0-9]+$/],
*[ele =~ /^[0-9]+,[0-9]+$/],
*[height =~ /^[0-9]+,[0-9]+$/],
*[width =~ /^[0-9]+,[0-9]+$/] {
        throwWarning: tr("some message for the comma");
        fixAdd: concat("{0.key}=", eval(replace(tag("{0.key}"), ",", ".")));
}

But it deletes the key (since the value is null)

Version 0, edited 6 years ago by naoliv (next)

comment:2 by Klumbumbus, 6 years ago

cc

comment:3 by Klumbumbus, 6 years ago

Type: defectenhancement

more like an enhancement than a defect, see ticket:15719#comment:4

for now it works with examples similar to ticket:15719#comment:2 or r12215 or r13345

Last edited 6 years ago by Klumbumbus (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to naoliv.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.