Permalink
Browse files

#CLJ-789 properly clear "tied" flag when exact method signature is av…

…ailable

Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information...
1 parent f81170d commit 62c432098beeb4362f1dd6cc1d18f4403c3bdd10 @cemerick cemerick committed with stuarthalloway May 10, 2011
View
@@ -8,6 +8,7 @@
<property name="src" location="src"/>
<property name="test" location="test"/>
<property name="jsrc" location="${src}/jvm"/>
+ <property name="jtestsrc" location="${test}/java"/>
<property name="cljsrc" location="${src}/clj"/>
<property name="cljscript" location="${src}/script"/>
<property name="test-script" location="${cljscript}/run_tests.clj"/>
@@ -77,6 +78,8 @@
unless="maven.test.skip">
<delete dir="${test-classes}"/>
<mkdir dir="${test-classes}"/>
+ <javac srcdir="${jtestsrc}" destdir="${test-classes}" includeJavaRuntime="yes"
+ debug="true" target="1.5" includeantruntime="no"/>
<java classname="clojure.lang.Compile"
classpath="${test-classes}:${test}:${build}:${cljsrc}"
failonerror="true"
View
@@ -48,6 +48,7 @@
<directory>src/clj</directory>
</resource>
</resources>
+ <testSourceDirectory>test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -2250,6 +2250,7 @@ static int getMatchingParams(String methodName, ArrayList<Class[]> paramlists, I
{
if(!foundExact || matchIdx == -1 || rets.get(matchIdx).isAssignableFrom(rets.get(i)))
matchIdx = i;
+ tied = false;
foundExact = true;
}
else if(match && !foundExact)
@@ -10,7 +10,8 @@
(ns clojure.test-clojure.compilation
- (:use clojure.test))
+ (:use clojure.test)
+ (:import compilation.TestDispatch))
; http://clojure.org/compilation
@@ -73,3 +74,9 @@
(recur (dec x))))
3)))
(catch Exception _)))))
+
+(deftest test-numeric-dispatch
+ (is (= "(int, int)" (TestDispatch/someMethod (int 1) (int 1))))
+ (is (= "(int, long)" (TestDispatch/someMethod (int 1) (long 1))))
+ (is (= "(long, long)" (TestDispatch/someMethod (long 1) (long 1)))))
+
@@ -0,0 +1,15 @@
+package compilation;
+
+public class TestDispatch {
+ public static String someMethod (int a, int b) {
+ return "(int, int)";
+ }
+
+ public static String someMethod (int a, long b) {
+ return "(int, long)";
+ }
+
+ public static String someMethod (long a, long b) {
+ return "(long, long)";
+ }
+}

0 comments on commit 62c4320

Please sign in to comment.