blob: 1c09977e9f0b65a0787d29251d05ecae4e5d459b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
(.require
[library
[lux (.except)
["[0]" ffi]
[abstract
[monad (.only do)]]
[control
["[0]" io]
["[0]" try (.use "[1]#[0]" functor)]]
[math
["[0]" random (.only Random)]
[number
["[0]" i64 (.use "[1]#[0]" equivalence)]
["n" nat]]]
[meta
[compiler
[target
[jvm
["[0]" modifier (.only Modifier)]
["[0]" method (.only Method)]
["[0]" type]
["!" bytecode]]]
[meta
["[0]" archive]]]]
[test
["_" property (.only Test)]]]]
[\\library
["[0]" / (.only)
[///
[field
[constant
["[0]" arity]]]
["[0]" // (.only)
["[0]" host]
["[0]" runtime]
[///
["[0]" extension]
[//
["[0]" phase]
["[0]" synthesis]
["[0]" translation]]]]]]]
[////
["[0]T" complex]])
(ffi.import (java/lang/Class of)
"[1]::[0]"
(getCanonicalName [] java/lang/String))
(ffi.import java/lang/Object
"[1]::[0]"
(getClass [] (java/lang/Class java/lang/Object)))
(def .public (test valid_modifier?)
(-> (-> (Modifier Method) Bit)
Test)
(<| (_.covering /._)
(do [! random.monad]
[module (random.lower_cased 1)
expected_i64 random.i64
.let [extender (is extension.Extender
(function (_ _)
(undefined)))
next (//.translate extender complexT.lux)
@ [module 0 0]]
arity (of ! each (|>> (n.% (-- arity.maximum)) (n.+ 2)) random.nat)
inner_arity (of ! each (|>> (n.% arity) (n.+ 1)) random.nat)])
(all _.and
(_.coverage [/.modifier]
(and (valid_modifier? /.modifier)
(modifier.has? method.static /.modifier)))
(_.coverage [/.name /.type /.method /.call]
(|> (do try.monad
[[_ archive] (archive.reserve "" archive.empty)
[_ archive] (archive.reserve module archive)
.let [[_ host] (io.run! host.host)
state (is runtime.State
(translation.state host module))]]
(<| (phase.result state)
(do phase.monad
[_ (translation.set_buffer translation.empty_buffer)
parameter (next archive (synthesis.i64 @ expected_i64))
function (next archive (synthesis.function/abstraction @ [(list) 1 (synthesis.variable/local @ 1)]))
it (|> function
[{.#None}]
(of host evaluate)
phase.of_try)
.let [class (type.class (|> it
(as java/lang/Object)
java/lang/Object::getClass
java/lang/Class::getCanonicalName
ffi.of_string)
(list))]]
(in (|> (do !.monad
[_ function
_ parameter]
(/.call class 1))
[{.#None}]
(of host evaluate)
(try#each (|>> (as I64)
(i64#= expected_i64)))
(try.else false)
)))))
(try.else false)))
)))
|