union types should test if its targets are really not assignable if it
is not an exact match
diff --git a/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/javascript/typeinfo/RUnionType.java b/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/javascript/typeinfo/RUnionType.java
index 2a4c209..3063a19 100644
--- a/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/javascript/typeinfo/RUnionType.java
+++ b/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/javascript/typeinfo/RUnionType.java
@@ -13,6 +13,7 @@
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
@@ -43,6 +44,16 @@
 			if (this.targets.containsAll(targets)) {
 				return TypeCompatibility.TRUE;
 			}
+			Set<IRType> compartible = new HashSet<IRType>();
+			for (IRType myTarget : this.targets) {
+				for (IRType theirTarget : targets) {
+					if (myTarget.isAssignableFrom(theirTarget) == TypeCompatibility.TRUE) {
+						compartible.add(theirTarget);
+					}
+				}
+			}
+			if (compartible.size() == targets.size())
+				return TypeCompatibility.TRUE;
 			return TypeCompatibility.FALSE;
 		}
 		for (IRType target : targets) {
diff --git a/tests/org.eclipse.dltk.javascript.core.tests/src/org/eclipse/dltk/javascript/core/tests/validation/TypeInfoValidationTests.java b/tests/org.eclipse.dltk.javascript.core.tests/src/org/eclipse/dltk/javascript/core/tests/validation/TypeInfoValidationTests.java
index 7da680d..712103f 100644
--- a/tests/org.eclipse.dltk.javascript.core.tests/src/org/eclipse/dltk/javascript/core/tests/validation/TypeInfoValidationTests.java
+++ b/tests/org.eclipse.dltk.javascript.core.tests/src/org/eclipse/dltk/javascript/core/tests/validation/TypeInfoValidationTests.java
@@ -3971,4 +3971,24 @@
 		final List<IProblem> problems = validate(code.toString());
 		assertEquals(problems.toString(), 1, problems.size());
 	}
+	
+	public void testUnionTypeWithArray() {
+		final StringList code = new StringList();
+		code.add("/**");
+		code.add(" * @param {Array<Array<*>|Number>} a");
+		code.add(" */");
+		code.add("function call(a) {}");
+		code.add("function test() {");
+		code.add("	var array1 = [1,2];");
+		code.add("	call(array1);");
+		code.add("	var array2 = [[1,2]];");
+		code.add("	call(array2);");
+		code.add("	var array3 = [[1,2],1];");
+		code.add("	call(array3);");
+		code.add("	var array4 = [['1','2'],1];");
+		code.add("	call(array4);");
+		code.add("}");
+		final List<IProblem> problems = validate(code.toString());
+		assertEquals(problems.toString(), 0, problems.size());
+	}
 }