Skip to content

Commit 6d72063

Browse files
committed
wip
1 parent 74c4af3 commit 6d72063

3 files changed

Lines changed: 86 additions & 2 deletions

File tree

build.clj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
(ns build
2-
(:require [clojure.tools.build.api :as b]))
2+
(:require
3+
[clojure.tools.build.api :as b]))
4+
5+
(def basis
6+
(b/create-basis {:project "deps.edn"}))
37

48
(defn compile-test-java [_]
59
(b/javac {:src-dirs ["src/test/java"]
6-
:class-dir "target/test-classes"}))
10+
:class-dir "target/test-classes"
11+
:basis basis}))

src/test/clojure/clojure/tools/analyzer/jvm/passes_test.clj

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,3 +392,41 @@
392392
(let [a (ast1 (clojure.tools.analyzer.jvm.test.FieldMethodOverload/doppelganger (int 1) (int 2)))]
393393
(is (= :static-call (:op a)))
394394
(is (:validated? a))))
395+
396+
#_(deftest static-field-method-bonanza
397+
(doseq [x '[clojure.tools.analyzer.jvm.test.Foo/bar
398+
(clojure.tools.analyzer.jvm.test.Foo/bar)
399+
((clojure.tools.analyzer.jvm.test.Foo/bar))
400+
(. clojure.tools.analyzer.jvm.test.Foo -bar)
401+
((. clojure.tools.analyzer.jvm.test.Foo -bar))
402+
(clojure.tools.analyzer.jvm.test.Foo/bar 1)
403+
((clojure.tools.analyzer.jvm.test.Foo/bar) 1)
404+
(. clojure.tools.analyzer.jvm.test.Foo -bar 1)
405+
((. clojure.tools.analyzer.jvm.test.Foo -bar) 1)
406+
(((. clojure.tools.analyzer.jvm.test.Foo -bar)) 1)
407+
clojure.tools.analyzer.jvm.test.Foo/baz
408+
(clojure.tools.analyzer.jvm.test.Foo/baz)
409+
((clojure.tools.analyzer.jvm.test.Foo/baz))
410+
(. clojure.tools.analyzer.jvm.test.Foo -baz)
411+
((. clojure.tools.analyzer.jvm.test.Foo -baz))
412+
(clojure.tools.analyzer.jvm.test.Foo/baz 1)
413+
((clojure.tools.analyzer.jvm.test.Foo/baz) 1)
414+
(. clojure.tools.analyzer.jvm.test.Foo -baz 1)
415+
((. clojure.tools.analyzer.jvm.test.Foo -baz) 1)
416+
clojure.tools.analyzer.jvm.test.Foo/qux
417+
(clojure.tools.analyzer.jvm.test.Foo/qux)
418+
((clojure.tools.analyzer.jvm.test.Foo/qux))
419+
(. clojure.tools.analyzer.jvm.test.Foo -qux)
420+
((. clojure.tools.analyzer.jvm.test.Foo -qux))
421+
(clojure.tools.analyzer.jvm.test.Foo/qux 1)
422+
((clojure.tools.analyzer.jvm.test.Foo/qux) 1)
423+
(. clojure.tools.analyzer.jvm.test.Foo -qux 1)
424+
((. clojure.tools.analyzer.jvm.test.Foo -qux) 1)]]
425+
(let [=? (fn [a b]
426+
(if (.startsWith (pr-str a) "#function")
427+
(= (a 1) (b 1))
428+
(= a b)))]
429+
(is (=? (try (eval x) (catch Exception _ ::exception))
430+
(try (eval (emit-form (ana x)))
431+
(catch Exception _ ::exception)))
432+
(str "bad " x)))))
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package clojure.tools.analyzer.jvm.test;
2+
3+
import clojure.lang.AFn;
4+
import clojure.lang.IFn;
5+
6+
public class Foo {
7+
8+
public static final IFn bar = new AFn() {
9+
public Object invoke() {
10+
return "bar";
11+
}
12+
public Object invoke(Object x) {
13+
return "bar" + x.toString();
14+
}
15+
};
16+
17+
public static final IFn baz = new AFn() {
18+
public Object invoke() {
19+
return "baz";
20+
}
21+
public Object invoke(Object x) {
22+
return "baz" + x.toString();
23+
}
24+
};
25+
26+
public static String bar() {
27+
return "bar()";
28+
}
29+
public static String bar(Object x) {
30+
return "bar()" + x.toString();
31+
}
32+
33+
34+
public static String qux() {
35+
return "qux()";
36+
}
37+
public static String qux(Object x) {
38+
return "qux()" + x.toString();
39+
}
40+
41+
}

0 commit comments

Comments
 (0)