diff --git a/library/src/commonMain/kotlin/de/westnordost/osm_legal_default_speeds/tagfilter/BooleanExpressionBuilder.kt b/library/src/commonMain/kotlin/de/westnordost/osm_legal_default_speeds/tagfilter/BooleanExpressionBuilder.kt index f72df21..9296854 100644 --- a/library/src/commonMain/kotlin/de/westnordost/osm_legal_default_speeds/tagfilter/BooleanExpressionBuilder.kt +++ b/library/src/commonMain/kotlin/de/westnordost/osm_legal_default_speeds/tagfilter/BooleanExpressionBuilder.kt @@ -50,8 +50,6 @@ internal class BooleanExpressionBuilder, T> { { node = node.parent!! } - - node.flatten() } fun addValue(i: I) { diff --git a/library/src/commonTest/kotlin/de/westnordost/osm_legal_default_speeds/tagfilter/TagFilterExpressionParserTest.kt b/library/src/commonTest/kotlin/de/westnordost/osm_legal_default_speeds/tagfilter/TagFilterExpressionParserTest.kt index 4861cbf..6af6e7b 100644 --- a/library/src/commonTest/kotlin/de/westnordost/osm_legal_default_speeds/tagfilter/TagFilterExpressionParserTest.kt +++ b/library/src/commonTest/kotlin/de/westnordost/osm_legal_default_speeds/tagfilter/TagFilterExpressionParserTest.kt @@ -458,7 +458,16 @@ internal class TagFilterExpressionParserTest { notMatches(mapOfKeys("a", "b", "c", "d"), expr) } - + @Test fun brackets_are_not_dissolved_illegally() { + val expr = "a or (b or c) and !d" + matches(mapOfKeys("a"), expr) + matches(mapOfKeys("a", "d"), expr) + matches(mapOfKeys("b"), expr) + matches(mapOfKeys("c"), expr) + notMatches(mapOfKeys("c", "d"), expr) + notMatches(mapOfKeys("b", "d"), expr) + matches(mapOfKeys("a", "c", "d"), expr) + } @Test fun fail_on_placeholder_not_closed() { shouldFail("{my placeholder")