Index: trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 7879)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 7881)
@@ -14,4 +14,5 @@
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -42,4 +43,5 @@
 import org.openstreetmap.josm.gui.mappaint.MultiCascade;
 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition;
+import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.ClassCondition;
 import org.openstreetmap.josm.gui.mappaint.mapcss.Expression;
 import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction;
@@ -48,4 +50,5 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector;
+import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.AbstractSelector;
 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.GeneralSelector;
 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser;
@@ -147,4 +150,5 @@
         protected final Map<Instruction.AssignmentInstruction, Severity> errors = new HashMap<>();
         protected final Map<String, Boolean> assertions = new HashMap<>();
+        protected final Set<String> setClassExpressions = new HashSet<>();
         protected boolean deletion = false;
 
@@ -207,10 +211,9 @@
         static TagCheck ofMapCSSRule(final GroupedMapCSSRule rule) throws IllegalDataException {
             final TagCheck check = new TagCheck(rule);
-            boolean containsSetClassExpression = false;
             for (Instruction i : rule.declaration.instructions) {
                 if (i instanceof Instruction.AssignmentInstruction) {
                     final Instruction.AssignmentInstruction ai = (Instruction.AssignmentInstruction) i;
                     if (ai.isSetInstruction) {
-                        containsSetClassExpression = true;
+                        check.setClassExpressions.add(ai.key);
                         continue;
                     }
@@ -263,8 +266,11 @@
                 }
             }
-            if (check.errors.isEmpty() && !containsSetClassExpression) {
-                throw new IllegalDataException("No "+POSSIBLE_THROWS+" given! You should specify a validation error message for " + rule.selectors);
+            if (check.errors.isEmpty() && check.setClassExpressions.isEmpty()) {
+                throw new IllegalDataException(
+                        "No "+POSSIBLE_THROWS+" given! You should specify a validation error message for " + rule.selectors);
             } else if (check.errors.size() > 1) {
-                throw new IllegalDataException("More than one "+POSSIBLE_THROWS+" given! You should specify a single validation error message for " + rule.selectors);
+                throw new IllegalDataException(
+                        "More than one "+POSSIBLE_THROWS+" given! You should specify a single validation error message for "
+                                + rule.selectors);
             }
             return check;
@@ -506,4 +512,48 @@
                 return null;
             }
+        }
+
+        /**
+         * Returns the set of tagchecks on which this check depends on.
+         * @param schecks the collection of tagcheks to search in
+         * @return the set of tagchecks on which this check depends on
+         * @since 7881
+         */
+        public Set<TagCheck> getTagCheckDependencies(Collection<TagCheck> schecks) {
+            Set<TagCheck> result = new HashSet<MapCSSTagChecker.TagCheck>();
+            Set<String> classes = getClassesIds();
+            if (schecks != null && !classes.isEmpty()) {
+                for (TagCheck tc : schecks) {
+                    if (this.equals(tc)) {
+                        continue;
+                    }
+                    for (String id : tc.setClassExpressions) {
+                        if (classes.contains(id)) {
+                            result.add(tc);
+                            break;
+                        }
+                    }
+                }
+            }
+            return result;
+        }
+
+        /**
+         * Returns the list of ids of all MapCSS classes referenced in the rule selectors.
+         * @return the list of ids of all MapCSS classes referenced in the rule selectors
+         * @since 7881
+         */
+        public Set<String> getClassesIds() {
+            Set<String> result = new HashSet<>();
+            for (Selector s : rule.selectors) {
+                if (s instanceof AbstractSelector) {
+                    for (Condition c : ((AbstractSelector)s).getConditions()) {
+                        if (c instanceof ClassCondition) {
+                            result.add(((ClassCondition) c).id);
+                        }
+                    }
+                }
+            }
+            return result;
         }
     }
@@ -654,8 +704,14 @@
                 }
                 final OsmPrimitive p = OsmUtils.createPrimitive(i.getKey());
+                // Build minimal ordered list of checks to run to test the assertion
+                List<Set<TagCheck>> checksToRun = new ArrayList<Set<TagCheck>>();
+                Set<TagCheck> checkDependencies = check.getTagCheckDependencies(schecks);
+                if (!checkDependencies.isEmpty()) {
+                    checksToRun.add(checkDependencies);
+                }
+                checksToRun.add(Collections.singleton(check));
                 // Add primitive to dataset to avoid DataIntegrityProblemException when evaluating selectors
                 ds.addPrimitive(p);
-                final Collection<TestError> pErrors = getErrorsForPrimitive(p, true,
-                        Collections.singleton(Collections.singleton(check)));
+                final Collection<TestError> pErrors = getErrorsForPrimitive(p, true, checksToRun);
                 if (Main.isDebugEnabled()) {
                     Main.debug("- Errors: "+pErrors);
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Instruction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Instruction.java	(revision 7879)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Instruction.java	(revision 7881)
@@ -87,5 +87,6 @@
         @Override
         public String toString() {
-            return key + ": " + (val instanceof float[] ? Arrays.toString((float[]) val) : val instanceof String ? "String<"+val+">" : val) + ';';
+            return key + ": " + (val instanceof float[] ? Arrays.toString((float[]) val) :
+                val instanceof String ? "String<"+val+">" : val) + ';';
         }
     }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java	(revision 7879)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java	(revision 7881)
@@ -428,4 +428,8 @@
         }
 
+        /**
+         * Returns the list of conditions.
+         * @return the list of conditions
+         */
         public List<Condition> getConditions() {
             if (conds == null) {
