rdl 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +13 -0
  3. data/CHANGES.md +35 -0
  4. data/README.md +153 -116
  5. data/bin/rdl_query +1 -1
  6. data/extras/type_tests/typetests.rb +905 -0
  7. data/lib/rdl.rb +0 -1
  8. data/lib/rdl/boot.rb +108 -77
  9. data/lib/rdl/boot_rails.rb +2 -8
  10. data/lib/rdl/config.rb +44 -17
  11. data/lib/rdl/contracts/flat.rb +1 -1
  12. data/lib/rdl/info.rb +3 -3
  13. data/lib/rdl/query.rb +11 -11
  14. data/lib/rdl/typecheck.rb +399 -136
  15. data/lib/rdl/types/finite_hash.rb +3 -2
  16. data/lib/rdl/types/generic.rb +7 -6
  17. data/lib/rdl/types/intersection.rb +3 -2
  18. data/lib/rdl/types/lexer.rex +2 -3
  19. data/lib/rdl/types/lexer.rex.rb +1 -4
  20. data/lib/rdl/types/method.rb +7 -6
  21. data/lib/rdl/types/nominal.rb +10 -1
  22. data/lib/rdl/types/parser.racc +7 -8
  23. data/lib/rdl/types/parser.tab.rb +108 -109
  24. data/lib/rdl/types/structural.rb +1 -0
  25. data/lib/rdl/types/tuple.rb +2 -2
  26. data/lib/rdl/types/type.rb +8 -8
  27. data/lib/rdl/types/type_inferencer.rb +1 -1
  28. data/lib/rdl/types/union.rb +2 -1
  29. data/lib/rdl/util.rb +28 -3
  30. data/lib/rdl/wrap.rb +216 -165
  31. data/lib/rdl_disable.rb +22 -15
  32. data/lib/types/core.rb +2 -4
  33. data/lib/types/core/_aliases.rb +14 -0
  34. data/lib/types/core/abbrev.rb +3 -0
  35. data/lib/types/core/array.rb +139 -0
  36. data/lib/types/core/base64.rb +8 -0
  37. data/lib/types/core/basic_object.rb +12 -0
  38. data/lib/types/core/benchmark.rb +9 -0
  39. data/lib/types/core/bigdecimal.rb +223 -0
  40. data/lib/types/core/bigmath.rb +10 -0
  41. data/lib/types/core/bignum.rb +214 -0
  42. data/lib/types/core/class.rb +15 -0
  43. data/lib/types/core/complex.rb +123 -0
  44. data/lib/types/core/coverage.rb +4 -0
  45. data/lib/types/core/csv.rb +3 -0
  46. data/lib/types/core/date.rb +4 -0
  47. data/lib/types/core/dir.rb +37 -0
  48. data/lib/types/core/encoding.rb +21 -0
  49. data/lib/types/core/enumerable.rb +96 -0
  50. data/lib/types/core/enumerator.rb +24 -0
  51. data/lib/types/core/exception.rb +15 -0
  52. data/lib/types/core/file.rb +125 -0
  53. data/lib/types/core/fileutils.rb +4 -0
  54. data/lib/types/core/fixnum.rb +213 -0
  55. data/lib/types/core/float.rb +199 -0
  56. data/lib/types/core/gem.rb +19 -0
  57. data/lib/types/core/hash.rb +72 -0
  58. data/lib/types/core/integer.rb +194 -0
  59. data/lib/types/core/io.rb +101 -0
  60. data/lib/types/core/kernel.rb +89 -0
  61. data/lib/types/core/marshal.rb +3 -0
  62. data/lib/types/core/matchdata.rb +24 -0
  63. data/lib/types/core/math.rb +50 -0
  64. data/lib/types/core/module.rb +81 -0
  65. data/lib/types/core/nil.rb +11 -0
  66. data/lib/types/core/numeric.rb +56 -0
  67. data/lib/types/core/object.rb +73 -0
  68. data/lib/types/core/pathname.rb +104 -0
  69. data/lib/types/core/proc.rb +12 -0
  70. data/lib/types/core/process.rb +110 -0
  71. data/lib/types/core/random.rb +13 -0
  72. data/lib/types/core/range.rb +37 -0
  73. data/lib/types/core/rational.rb +207 -0
  74. data/lib/types/core/regexp.rb +28 -0
  75. data/lib/types/core/set.rb +56 -0
  76. data/lib/types/core/string.rb +140 -0
  77. data/lib/types/core/strscan.rb +6 -0
  78. data/lib/types/core/symbol.rb +27 -0
  79. data/lib/types/core/time.rb +66 -0
  80. data/lib/types/core/uri.rb +18 -0
  81. data/lib/types/core/yaml.rb +3 -0
  82. data/lib/types/devise.rb +1 -0
  83. data/lib/types/devise/controller_helpers.rb +3 -0
  84. data/lib/types/devise/parameter_sanitizer.rb +2 -0
  85. data/lib/types/pundit.rb +2 -0
  86. data/lib/types/rails/_helpers.rb +50 -0
  87. data/lib/types/rails/abstract_controller/translation.rb +2 -0
  88. data/lib/types/rails/action_controller/base.rb +3 -0
  89. data/lib/types/rails/action_controller/instrumentation.rb +6 -0
  90. data/lib/types/rails/action_controller/metal.rb +3 -0
  91. data/lib/types/rails/action_controller/mime_responds.rb +13 -0
  92. data/lib/types/rails/action_controller/parameters.rb +3 -0
  93. data/lib/types/{rails-5.x → rails}/action_controller/strong_parameters.rb +4 -8
  94. data/lib/types/rails/action_dispatch/flashhash.rb +8 -0
  95. data/lib/types/rails/action_dispatch/routing.rb +10 -0
  96. data/lib/types/rails/action_mailer/base.rb +2 -0
  97. data/lib/types/rails/action_mailer/message_delivery.rb +2 -0
  98. data/lib/types/rails/action_view/helpers_sanitizehelper.rb +2 -0
  99. data/lib/types/rails/action_view/helpers_urlhelper.rb +5 -0
  100. data/lib/types/rails/active_model/errors.rb +14 -0
  101. data/lib/types/rails/active_model/validations.rb +2 -0
  102. data/lib/types/rails/active_record/associations.rb +208 -0
  103. data/lib/types/rails/active_record/base.rb +2 -0
  104. data/lib/types/rails/active_record/core.rb +2 -0
  105. data/lib/types/rails/active_record/finder_methods.rb +2 -0
  106. data/lib/types/rails/active_record/model_schema.rb +37 -0
  107. data/lib/types/rails/active_record/relation.rb +11 -0
  108. data/lib/types/rails/active_record/schema_types.rb +51 -0
  109. data/lib/types/rails/active_record/validations.rb +2 -0
  110. data/lib/types/rails/active_support/base.rb +2 -0
  111. data/lib/types/rails/active_support/logger.rb +3 -0
  112. data/lib/types/rails/active_support/tagged_logging.rb +2 -0
  113. data/lib/types/rails/active_support/time_with_zone.rb +13 -0
  114. data/lib/types/rails/active_support/time_zone.rb +2 -0
  115. data/lib/types/rails/fixnum.rb +2 -0
  116. data/lib/types/rails/integer.rb +2 -0
  117. data/lib/types/rails/rack/request.rb +2 -0
  118. data/lib/types/rails/string.rb +3 -0
  119. data/lib/types/rails/time.rb +1 -0
  120. data/rdl.gemspec +2 -2
  121. data/test/disabled_test_rdoc.rb +8 -8
  122. data/test/test_alias.rb +1 -0
  123. data/test/test_dsl.rb +4 -4
  124. data/test/test_generic.rb +45 -38
  125. data/test/test_intersection.rb +10 -10
  126. data/test/test_le.rb +103 -102
  127. data/test/test_member.rb +33 -33
  128. data/test/test_parser.rb +101 -96
  129. data/test/test_query.rb +84 -84
  130. data/test/test_rdl.rb +87 -52
  131. data/test/test_rdl_type.rb +26 -9
  132. data/test/test_type_contract.rb +32 -31
  133. data/test/test_typecheck.rb +802 -436
  134. data/test/test_types.rb +39 -39
  135. data/test/test_wrap.rb +3 -2
  136. metadata +91 -120
  137. data/extras/type_tests/%.rb +0 -171
  138. data/extras/type_tests/&.rb +0 -159
  139. data/extras/type_tests/**.rb +0 -222
  140. data/extras/type_tests/*.rb +0 -177
  141. data/extras/type_tests/+.rb +0 -170
  142. data/extras/type_tests/-.rb +0 -171
  143. data/extras/type_tests/1scomp.rb +0 -157
  144. data/extras/type_tests/<.rb +0 -170
  145. data/extras/type_tests/<<.rb +0 -159
  146. data/extras/type_tests/>>.rb +0 -159
  147. data/extras/type_tests/[].rb +0 -163
  148. data/extras/type_tests/^.rb +0 -159
  149. data/extras/type_tests/abs.rb +0 -155
  150. data/extras/type_tests/abs2.rb +0 -164
  151. data/extras/type_tests/angle.rb +0 -157
  152. data/extras/type_tests/arg.rb +0 -157
  153. data/extras/type_tests/bit_length.rb +0 -157
  154. data/extras/type_tests/ceil.rb +0 -157
  155. data/extras/type_tests/ceilRational.rb +0 -160
  156. data/extras/type_tests/conj.rb +0 -158
  157. data/extras/type_tests/defwhere.rb +0 -86
  158. data/extras/type_tests/denominator.rb +0 -157
  159. data/extras/type_tests/div.rb +0 -172
  160. data/extras/type_tests/divslash.rb +0 -179
  161. data/extras/type_tests/even?.rb +0 -157
  162. data/extras/type_tests/fdiv.rb +0 -244
  163. data/extras/type_tests/finite?.rb +0 -157
  164. data/extras/type_tests/floor.rb +0 -157
  165. data/extras/type_tests/floorRational.rb +0 -161
  166. data/extras/type_tests/hash.rb +0 -157
  167. data/extras/type_tests/imag.rb +0 -158
  168. data/extras/type_tests/infinite?.rb +0 -157
  169. data/extras/type_tests/modulo.rb +0 -171
  170. data/extras/type_tests/nan?.rb +0 -157
  171. data/extras/type_tests/neg.rb +0 -155
  172. data/extras/type_tests/next.rb +0 -157
  173. data/extras/type_tests/next_float.rb +0 -157
  174. data/extras/type_tests/numerator.rb +0 -157
  175. data/extras/type_tests/phase.rb +0 -157
  176. data/extras/type_tests/prev_float.rb +0 -157
  177. data/extras/type_tests/quo.rb +0 -179
  178. data/extras/type_tests/rationalize.rb +0 -157
  179. data/extras/type_tests/rationalizeArg.rb +0 -198
  180. data/extras/type_tests/real.rb +0 -157
  181. data/extras/type_tests/real?.rb +0 -157
  182. data/extras/type_tests/round.rb +0 -157
  183. data/extras/type_tests/roundArg.rb +0 -169
  184. data/extras/type_tests/size.rb +0 -157
  185. data/extras/type_tests/to_c.rb +0 -157
  186. data/extras/type_tests/to_f.rb +0 -155
  187. data/extras/type_tests/to_i.rb +0 -157
  188. data/extras/type_tests/to_r.rb +0 -157
  189. data/extras/type_tests/to_s.rb +0 -157
  190. data/extras/type_tests/truncate.rb +0 -157
  191. data/extras/type_tests/truncateArg.rb +0 -166
  192. data/extras/type_tests/type tests +0 -1
  193. data/extras/type_tests/zero?.rb +0 -155
  194. data/extras/type_tests/|.rb +0 -159
  195. data/lib/types/core-ruby-2.x/_aliases.rb +0 -15
  196. data/lib/types/core-ruby-2.x/abbrev.rb +0 -5
  197. data/lib/types/core-ruby-2.x/array.rb +0 -137
  198. data/lib/types/core-ruby-2.x/base64.rb +0 -10
  199. data/lib/types/core-ruby-2.x/basic_object.rb +0 -14
  200. data/lib/types/core-ruby-2.x/benchmark.rb +0 -11
  201. data/lib/types/core-ruby-2.x/bigdecimal.rb +0 -224
  202. data/lib/types/core-ruby-2.x/bigmath.rb +0 -12
  203. data/lib/types/core-ruby-2.x/bignum.rb +0 -214
  204. data/lib/types/core-ruby-2.x/class.rb +0 -17
  205. data/lib/types/core-ruby-2.x/complex.rb +0 -124
  206. data/lib/types/core-ruby-2.x/coverage.rb +0 -6
  207. data/lib/types/core-ruby-2.x/csv.rb +0 -5
  208. data/lib/types/core-ruby-2.x/date.rb +0 -6
  209. data/lib/types/core-ruby-2.x/dir.rb +0 -38
  210. data/lib/types/core-ruby-2.x/encoding.rb +0 -23
  211. data/lib/types/core-ruby-2.x/enumerable.rb +0 -98
  212. data/lib/types/core-ruby-2.x/enumerator.rb +0 -26
  213. data/lib/types/core-ruby-2.x/exception.rb +0 -17
  214. data/lib/types/core-ruby-2.x/file.rb +0 -126
  215. data/lib/types/core-ruby-2.x/fileutils.rb +0 -6
  216. data/lib/types/core-ruby-2.x/fixnum.rb +0 -213
  217. data/lib/types/core-ruby-2.x/float.rb +0 -199
  218. data/lib/types/core-ruby-2.x/gem.rb +0 -247
  219. data/lib/types/core-ruby-2.x/hash.rb +0 -72
  220. data/lib/types/core-ruby-2.x/integer.rb +0 -197
  221. data/lib/types/core-ruby-2.x/io.rb +0 -103
  222. data/lib/types/core-ruby-2.x/kernel.rb +0 -90
  223. data/lib/types/core-ruby-2.x/marshal.rb +0 -5
  224. data/lib/types/core-ruby-2.x/matchdata.rb +0 -26
  225. data/lib/types/core-ruby-2.x/math.rb +0 -53
  226. data/lib/types/core-ruby-2.x/module.rb +0 -83
  227. data/lib/types/core-ruby-2.x/nil.rb +0 -12
  228. data/lib/types/core-ruby-2.x/numeric.rb +0 -56
  229. data/lib/types/core-ruby-2.x/object.rb +0 -75
  230. data/lib/types/core-ruby-2.x/pathname.rb +0 -106
  231. data/lib/types/core-ruby-2.x/proc.rb +0 -16
  232. data/lib/types/core-ruby-2.x/process.rb +0 -127
  233. data/lib/types/core-ruby-2.x/random.rb +0 -17
  234. data/lib/types/core-ruby-2.x/range.rb +0 -39
  235. data/lib/types/core-ruby-2.x/rational.rb +0 -209
  236. data/lib/types/core-ruby-2.x/regexp.rb +0 -30
  237. data/lib/types/core-ruby-2.x/set.rb +0 -58
  238. data/lib/types/core-ruby-2.x/string.rb +0 -143
  239. data/lib/types/core-ruby-2.x/strscan.rb +0 -7
  240. data/lib/types/core-ruby-2.x/symbol.rb +0 -29
  241. data/lib/types/core-ruby-2.x/time.rb +0 -68
  242. data/lib/types/core-ruby-2.x/uri.rb +0 -20
  243. data/lib/types/core-ruby-2.x/yaml.rb +0 -5
  244. data/lib/types/rails-5.x/_helpers.rb +0 -52
  245. data/lib/types/rails-5.x/action_controller/mime_responds.rb +0 -11
  246. data/lib/types/rails-5.x/action_dispatch/routing.rb +0 -10
  247. data/lib/types/rails-5.x/active_model/errors.rb +0 -15
  248. data/lib/types/rails-5.x/active_model/validations.rb +0 -5
  249. data/lib/types/rails-5.x/active_record/associations.rb +0 -190
  250. data/lib/types/rails-5.x/active_record/core.rb +0 -3
  251. data/lib/types/rails-5.x/active_record/model_schema.rb +0 -39
  252. data/lib/types/rails-5.x/fixnum.rb +0 -3
@@ -1,83 +0,0 @@
1
- class Module
2
- rdl_nowrap
3
-
4
- type 'self.constants', '() -> Array<Fixnum>' # also constants(inherited), but undocumented
5
- type 'self.nesting', '() -> Array<Module>'
6
- type 'self.new', '() -> Module'
7
- type 'self.new', '() { (Module) -> %any } -> Module'
8
-
9
- type :<, '(Module other) -> %bool or nil'
10
- type :<=, '(Module other) -> %bool or nil'
11
- type :<=>, '(Module other) -> -1 or 0 or 1 or nil'
12
- type :==, '(%any other) -> %bool'
13
- type :equal, '(%any other) -> %bool'
14
- type :eql, '(%any other) -> %bool'
15
- type :===, '(%any other) -> %bool'
16
- type :>, '(Module other) -> %bool or nil'
17
- type :>=, '(Module other) -> %bool or nil'
18
- type :ancestors, '() -> Array<Module>'
19
- type :autoload, '(Symbol module, String filename) -> nil'
20
- type :autoload?, '(Symbol name) -> String or nil'
21
- type :class_eval, '(String, ?String filename, ?Fixnum lineno) -> %any'
22
- type :class_exec, '(*%any args) { (*%any args) -> %any } -> %any'
23
- type :class_variable_defined?, '(Symbol or String) -> %bool'
24
- type :class_variable_get, '(Symbol or String) -> %any'
25
- type :class_variable_set, '(Symbol or String, %any) -> %any'
26
- type :class_variables, '(?%bool inherit) -> Array<Symbol>'
27
- type :const_defined?, '(Symbol or String, ?%bool inherit) -> %bool'
28
- type :const_get, '(Symbol or String, ?%bool inherit) -> %any'
29
- type :const_missing, '(Symbol) -> %any'
30
- type :const_set, '(Symbol or String, %any) -> %any'
31
- type :constants, '(?%bool inherit) -> Array<Symbol>'
32
- type :freeze, '() -> self'
33
- type :include, '(*Module) -> self'
34
- type :include?, '(Module) -> %bool'
35
- type :included_modules, '() -> Array<Module>'
36
- rdl_alias :inspect, :to_s
37
- type :instance_method, '(Symbol) -> UnboundMethod'
38
- type :instance_methods, '(?%bool include_super) -> Array<Symbol>'
39
- type :method_defined?, '(Symbol or String) -> %bool'
40
- type :module_eval, '(String, ?String filename, ?Fixnum lineno) -> %any' # matches rdoc example but not type
41
- type :module_exec, '(*%any args) { (*%any args) -> %any } -> %any'
42
- type :name, '() -> String'
43
- type :prepend, '(*Module) -> self'
44
- type :private_class_method, '(*(Symbol or String)) -> self'
45
- type :private_constant, '(*Symbol) -> self'
46
- type :private_instance_methods, '(?%bool include_super) -> Array<Symbol>'
47
- type :private_method_defined?, '(Symbol or String) -> %bool'
48
- type :protected_instance_methods, '(?%bool include_super) -> Array<Symbol>'
49
- type :protected_method_defined?, '(Symbol or String) -> %bool'
50
- type :public_class_method, '(*(Symbol or String)) -> self'
51
- type :public_constant, '(*Symbol) -> self'
52
- type :public_instance_method, '(Symbol) -> UnboundMethod'
53
- type :public_instance_methods, '(?%bool include_super) -> Array<Symbol>'
54
- type :public_method_defined?, '(Symbol or String) -> %bool'
55
- type :remove_class_variable, '(Symbol) -> %any'
56
- type :singleton_class?, '() -> %bool'
57
- type :to_s, '() -> String'
58
- # private methods below here
59
- type :alias_method, '(Symbol new_name, Symbol old_name) -> self'
60
- type :append_features, '(Module) -> self'
61
- rdl_alias :attr, :attr_reader
62
- type :attr_accessor, '(*(Symbol or String)) -> nil'
63
- type :attr_reader, '(*(Symbol or String)) -> nil'
64
- type :attr_writer, '(*(Symbol or String)) -> nil'
65
- type :define_method, '(Symbol, Method) -> Symbol'
66
- type :define_method, '(Symbol) { (*%any) -> %any } -> Symbol'
67
- type :extend_object, '(%any) -> %any'
68
- type :extended, '(Module othermod) -> %any'
69
- type :included, '(Module othermod) -> %any'
70
- type :method_added, '(Symbol method_name) -> %any'
71
- type :method_removed, '(Symbol method_name) -> %any'
72
- type :module_function, '(*(Symbol or String)) -> self'
73
- type :prepend_features, '(Module) -> self'
74
- type :prepended, '(Module othermod) -> %any'
75
- type :private, '(*(Symbol or String)) -> self'
76
- type :protected, '(*(Symbol or String)) -> self'
77
- type :public, '(*(Symbol or String)) -> self'
78
- type :refine, '(Class) { (%any) -> %any } -> self' # ??
79
- type :remove_const, '(Symbol) -> %any'
80
- type :remove_method, '(Symbol or String) -> self'
81
- type :undef_method, '(Symbol or String) -> self'
82
- type :using, '(Module) -> self'
83
- end
@@ -1,12 +0,0 @@
1
- class NilClass
2
- rdl_nowrap
3
- type :&, '(%any obj) -> false'
4
- type :'^', '(%any obj) -> %bool'
5
- type :|, '(%any obj) -> %bool'
6
- type :rationalize, '() -> Rational'
7
- type :to_a, '() -> []'
8
- type :to_c, '() -> Complex'
9
- type :to_f, '() -> 0.0'
10
- type :to_h, '() -> {}'
11
- type :to_r, '() -> Rational'
12
- end
@@ -1,56 +0,0 @@
1
- class Numeric
2
- rdl_nowrap
3
-
4
- type :%, '(%numeric) -> %numeric'
5
- pre(:%) { |x| x!=0}
6
- type :+, '(%numeric) -> %numeric'
7
- type :-, '() -> %numeric'
8
- type :<=>, '(%numeric) -> Object'
9
- post(:<=>) { |r,x| r == -1 || r==0 || r==1 || r==nil}
10
- type :abs, '() -> %numeric'
11
- post(:abs) { |r,x| r >= 0 }
12
- type :abs2, '() -> %numeric'
13
- post(:abs2) { |r,x| r >= 0 }
14
- type :angle, '() -> %numeric'
15
- type :arg, '() -> %numeric'
16
- type :ceil, '() -> %integer'
17
- type :coerce, '(%numeric) -> [%numeric, %numeric]'
18
- type :conj, '() -> %numeric'
19
- type :conjugate, '() -> %numeric'
20
- type :denominator, '() -> %integer'
21
- post(:denominator) { |r,x| r >= 0 }
22
- type :div, '(%numeric) -> %integer'
23
- pre(:div) { |x| x!=0}
24
- type :divmod, '(%numeric) -> [%numeric, %numeric]'
25
- pre(:divmod) { |x| x!=0 }
26
- type :eql?, '(%numeric) -> %bool'
27
- type :fdiv, '(%numeric) -> %numeric'
28
- type :floor, '() -> %integer'
29
- type :i, '() -> Complex'
30
- type :imag, '() -> %numeric'
31
- type :imaginary, '() -> %numeric'
32
- type :integer?, '() -> %bool'
33
- type :magnitude, '() -> %numeric'
34
- type :modulo, '(%numeric) -> %real'
35
- pre(:modulo) { |x| x!=0 }
36
- type :nonzero?, '() -> self or nil'
37
- type :numerator, '() -> %integer'
38
- type :phase, '() -> %numeric'
39
- type :polar, '() -> [%numeric, %numeric]'
40
- type :quo, '(%numeric) -> %numeric'
41
- type :real, '() -> %numeric'
42
- type :real?, '() -> %numeric'
43
- type :rect, '() -> [%numeric, %numeric]'
44
- type :rectangular, '() -> [%numeric, %numeric]'
45
- type :remainder, '(%numeric) -> %real'
46
- type :round, '(%numeric) -> %numeric'
47
- type :singleton_method_added, '(Symbol) -> TypeError'
48
- type :step, '(%numeric) { (%numeric) -> %any } -> %numeric'
49
- type :step, '(%numeric) -> Enumerator<%numeric>'
50
- type :step, '(%numeric, %numeric) { (%numeric) -> %any } -> %numeric'
51
- type :step, '(%numeric, %numeric) -> Enumerator<%numeric>'
52
- type :to_c, '() -> Complex'
53
- type :to_int, '() -> %integer'
54
- type :truncate, '() -> %integer'
55
- type :zero?, '() -> %bool'
56
- end
@@ -1,75 +0,0 @@
1
- class Object
2
- # Instead of rdl_nowrap, mark individual methods as not being wrapped so
3
- # we can wrap stuff defined by the user at the top level (since those
4
- # methods are added to Object).
5
-
6
- # type :ARGF, ARGF
7
- # type :ARGV, 'Array<String>'
8
- # type :DATA, 'File'
9
- # type :ENV, ENV
10
- # type :FALSE, '%false'
11
- # type :NIL, 'nil'
12
- # type :RUBY_COPYRIGHT, 'String'
13
- # type :RUBY_DESCRIPTION, 'String'
14
- # type :RUBY_ENGINE, 'String'
15
- # type :RUBY_PATCHLEVEL, Fixnum
16
- # type :RUBY_PLATFORM, 'String'
17
- # type :RUBY_RELEASE_DATE, 'String'
18
- # type :RUBY_REVISION, Fixnum
19
- # type :RUBY_VERSION, 'String'
20
- # type :STDERR, 'IO'
21
- # type :STDIN, 'IO'
22
- # type :STDOUT, 'IO'
23
- # type :TOPLEVEL_BINDING, 'Binding'
24
- # type :TRUE, '%true'
25
-
26
- type :!~, '(%any other) -> %bool', wrap: false
27
- type :<=>, '(%any other) -> Fixnum or nil', wrap: false
28
- type :===, '(%any other) -> %bool', wrap: false
29
- type :=~, '(%any other) -> nil', wrap: false
30
- type :class, '() -> Class', wrap: false
31
- type :clone, '() -> self', wrap: false
32
- # type :define_singleton_method, '(XXXX : *XXXX)') # TODO
33
- type :display, '(IO port) -> nil', wrap: false
34
- type :dup, '() -> self an_object', wrap: false
35
- type :enum_for, '(?Symbol method, *%any args) -> Enumerator<%any>', wrap: false
36
- type :enum_for, '(?Symbol method, *%any args) { (*%any args) -> %any } -> Enumerator<%any>', wrap: false
37
- type :eql?, '(%any other) -> %bool', wrap: false
38
- # type :extend, '(XXXX : *XXXX)') # TODO
39
- type :freeze, '() -> self', wrap: false
40
- type :frozen?, '() -> %bool', wrap: false
41
- type :hash, '() -> Fixnum', wrap: false
42
- type :inspect, '() -> String', wrap: false
43
- type :instance_of?, '(Class) -> %bool', wrap: false
44
- type :instance_variable_defined?, '(Symbol or String) -> %bool', wrap: false
45
- type :instance_variable_get, '(Symbol or String) -> %any', wrap: false
46
- type :instance_variable_set, '(Symbol or String, %any) -> %any', wrap: false # returns 2nd argument
47
- type :instance_variables, '() -> Array<Symbol>', wrap: false
48
- type :is_a?, '(Class or Module) -> %bool', wrap: false
49
- type :kind_of?, '(Class) -> %bool', wrap: false
50
- type :method, '(Symbol) -> Method', wrap: false
51
- type :methods, '(?%bool regular) -> Array<Symbol>', wrap: false
52
- type :nil?, '() -> %bool', wrap: false
53
- type :private_methods, '(?%bool all) -> Array<Symbol>', wrap: false
54
- type :protected_methods, '(?%bool all) -> Array<Symbol>', wrap: false
55
- type :public_method, '(Symbol) -> Method', wrap: false
56
- type :public_methods, '(?%bool all) -> Array<Symbol>', wrap: false
57
- type :public_send, '(Symbol or String, *%any args) -> %any', wrap: false
58
- type :remove_instance_variable, '(Symbol) -> %any', wrap: false
59
- # type :respond_to?, '(Symbol or String, ?%bool include_all) -> %bool'
60
- type :send, '(Symbol or String, *%any args) -> %any', wrap: false # Can't wrap this, used outside wrap switch
61
- type :singleton_class, '() -> Class', wrap: false
62
- type :singleton_method, '(Symbol) -> Method', wrap: false
63
- type :singleton_methods, '(?%bool all) -> Array<Symbol>', wrap: false
64
- type :taint, '() -> self', wrap: false
65
- type :tainted?, '() -> %bool', wrap: false
66
- # type :tap, '()') # TODO
67
- type :to_enum, '(?Symbol method, *%any args) -> Enumerator<%any>', wrap: false
68
- type :to_enum, '(?Symbol method, *%any args) {(*%any args) -> %any} -> Enumerator<%any>', wrap: false
69
- # TODO: above alias for enum_for?
70
- type :to_s, '() -> String', wrap: false
71
- type :trust, '() -> self', wrap: false
72
- type :untaint, '() -> self', wrap: false
73
- type :untrust, '() -> self', wrap: false
74
- type :untrusted?, '() -> %bool', wrap: false
75
- end
@@ -1,106 +0,0 @@
1
- class Pathname
2
- rdl_nowrap
3
-
4
- type 'self.getwd', '() -> Pathname'
5
- type 'self.glob', '(String p1, ?String p2) -> Array<Pathname>'
6
- type 'self.new', '(%string or Pathname p1) -> Pathname' # p1 can be String-like
7
- rdl_alias 'self.pwd', 'self.getwd'
8
- type :+, '(String or Pathname other) -> Pathname'
9
- rdl_alias :/, :+
10
- type :<=>, '(%any p1) -> -1 or 0 or 1 or nil'
11
- type :==, '(%any p1) -> %bool'
12
- type :===, '(%any p1) -> %bool'
13
- type :absolute?, '() -> %bool'
14
- type :ascend, '() { (Pathname) -> %any } -> %any'
15
- type :atime, '() -> Time'
16
- type :basename, '(?String p1) -> Pathname' # guessing about arg type
17
- type :binread, '(?Fixnum length, ?Fixnum offset) -> String'
18
- type :binwrite, '(String, ?Fixnum offset) -> Fixnum' # TODO open_args
19
- type :birthtime, '() -> Time'
20
- type :blockdev?, '() -> %bool'
21
- type :chardev?, '() -> %bool'
22
- type :children, '(%bool with_directory) -> Array<Pathname>'
23
- type :chmod, '(Fixnum mode) -> Fixnum'
24
- type :chown, '(Fixnum owner, Fixnum group) -> Fixnum'
25
- type :cleanpath, '(?%bool consider_symlink) -> %any'
26
- type :ctime, '() -> Time'
27
- type :delete, '() -> %any'
28
- type :descend, '() { (Pathname) -> %any } -> %any'
29
- type :directory?, '() -> %bool'
30
- type :dirname, '() -> Pathname'
31
- type :each_child, '(%bool with_directory) { (Pathname) -> %any } -> %any'
32
- type :each_entry, '() { (Pathname) -> %any } -> %any'
33
- type :each_filename, '() { (String) -> %any } -> %any'
34
- type :each_filename, '() -> Enumerator<String>'
35
- type :each_line, '(?String sep, ?Fixnum limit) { (String) -> %any } -> %any' # TODO open_args
36
- type :each_line, '(?String sep, ?Fixnum limit) -> Enumerator<String>'
37
- type :entries, '() -> Array<Pathname>'
38
- type :eql?, '(%any) -> %bool'
39
- type :executable?, '() -> %bool'
40
- type :executable_real?, '() -> %bool'
41
- type :exist?, '() -> %bool'
42
- type :expand_path, '(?(String or Pathname) p1) -> Pathname'
43
- type :extname, '() -> String'
44
- type :file?, '() -> %bool'
45
- type :find, '(%bool ignore_error) { (Pathname) -> %any } -> %any'
46
- type :find, '(%bool ignore_error) -> Enumerator<Pathname>'
47
- type :fnmatch, '(String pattern, ?Fixnum flags) -> %bool'
48
- type :freeze, '() -> self' # TODO return type?
49
- type :ftype, '() -> String'
50
- type :grpowned?, '() -> %bool'
51
- type :join, '(*(String or Pathname) args) -> Pathname'
52
- type :lchmod, '(Fixnum mode) -> Fixnum'
53
- type :lchown, '(Fixnum owner, Fixnum group) -> Fixnum'
54
- type :lstat, '() -> File::Stat'
55
- type :make_link, '(String old) -> 0'
56
- type :symlink, '(String old) -> 0'
57
- type :mkdir, '(String p1) -> 0'
58
- type :mkpath, '() -> %any' # TODO return?
59
- type :mountpoint?, '() -> %bool'
60
- type :mtime, '() -> Time'
61
- type :open, '(?String mode, ?String perm, ?Fixnum opt) -> File'
62
- type :open, '(?String mode, ?String perm, ?Fixnum opt) { (File) -> t } -> t'
63
- type :opendir, '(?Encoding) -> Dir'
64
- type :opendir, '(?Encoding) { (Dir) -> u } -> u'
65
- type :owned?, '() -> %bool'
66
- type :parent, '() -> Pathname'
67
- type :pipe?, '() -> %bool'
68
- type :read, '(?Fixnum length, ?Fixnum offset, ?Fixnum open_args) -> String'
69
- type :readable?, '() -> %bool'
70
- type :readable_real, '() -> %bool'
71
- type :readlines, '(?String sep, ?Fixnum limit, ?Fixnum open_args) -> Array<String>'
72
- type :readlink, '() -> String file'
73
- type :realdirpath, '(?String p1) -> String'
74
- type :realpath, '(?String p1) -> String'
75
- type :relative?, '() -> %bool'
76
- type :relative_path_from, '(String or Pathname base_directory) -> Pathname'
77
- type :rename, '(String p1) -> 0'
78
- type :rmdir, '() -> 0'
79
- type :rmtree, '() -> 0'
80
- type :root?, '() -> %bool'
81
- type :setgid?, '() -> %bool'
82
- type :setuid?, '() -> %bool'
83
- type :size, '() -> Fixnum'
84
- type :size?, '() -> %bool'
85
- type :socket?, '() -> %bool'
86
- type :split, '() -> [Pathname, Pathname]'
87
- type :stat, '() -> File::Stat'
88
- type :sticky?, '() -> %bool'
89
- type :sub, '(*String args) -> Pathname'
90
- type :sub_ext, '(String p1) -> Pathname'
91
- type :symlink?, '() -> %bool'
92
- type :sysopen, '(?Fixnum mode, ?Fixnum perm) -> Fixnum'
93
- type :taint, '() -> self'
94
- type :to_path, '() -> String'
95
- rdl_alias :to_s, :to_path
96
- type :truncate, '(Fixnum length) -> 0'
97
- type :unlink, '() -> Fixnum'
98
- type :untaint, '() -> self'
99
- type :utime, '(Time atime, Time mtime) -> Fixnum'
100
- type :world_readable?, '() -> %bool'
101
- type :world_writable?, '() -> %bool'
102
- type :writable?, '() -> %bool'
103
- type :writable_real?, '() -> %bool'
104
- type :write, '(String, ?Fixnum offset, ?Fixnum open_args) -> Fixnum'
105
- type :zero?, '() -> %bool'
106
- end
@@ -1,16 +0,0 @@
1
- class Proc
2
- rdl_nowrap
3
-
4
- type :arity, '() -> %integer'
5
- type :binding, '() -> Binding'
6
- type :curry, '(?%integer arity) -> Proc'
7
- type :hash, '() -> %integer'
8
- rdl_alias :inspect, :to_s
9
- type :lambda, '() -> %bool'
10
- type :parameters, '() -> Array<[Symbol, Symbol]>'
11
- type :source_location, '() -> [String, %integer]'
12
- type :to_proc, '() -> self'
13
- type :to_s, '() -> String'
14
-
15
-
16
- end
@@ -1,127 +0,0 @@
1
- module Process
2
- rdl_nowrap
3
-
4
- type 'self.abort', '(?String msg) -> %any'
5
- type 'self.argv0', '() -> String frozen_string'
6
- type 'self.clock_getres', '(Symbol or Fixnum clock_id, ?Symbol unit) -> Float or Integer'
7
- type 'self.clock_gettime', '(Symbol or Fixnum clock_id, ?Symbol unit) -> Float or Integer'
8
- type 'self.daemon', '(?%any nochdir, ?%any noclose) -> 0'
9
- type 'self.detach', '(Fixnum pid) -> Thread'
10
- type 'self.egid', '() -> Fixnum'
11
- type 'self.egid=', '(Fixnum) -> Fixnum'
12
- type 'self.euid', '() -> Fixnum'
13
- type 'self.euid=', '(Fixnum) -> Fixnum user'
14
- # type 'self.exec', '(env: ?Hash<String, String>, command:String, args:*String) -> %any' # TODO: env
15
- type 'self.exit', '(?Fixnum status) -> %any'
16
- type 'self.exit!', '(?Fixnum status) -> %any'
17
- type 'self.fork', '() -> Fixnum or nil'
18
- type 'self.fork', '() { () -> %any } -> Fixnum or nil'
19
- type 'self.getpgid', '(Fixnum pid) -> Fixnum'
20
- type 'self.getpgrp', '() -> Fixnum'
21
- type 'self.getpriority', '(Fixnum kind, Fixnum) -> Fixnum'
22
- type 'self.getrlimit', '(Symbol or String or Fixnum resource) -> [Fixnum, Fixnum] cur_max_limit'
23
- type 'self.getsid', '(?Fixnum pid) -> Integer'
24
- type 'self.gid', '() -> Fixnum'
25
- type 'self.gid=', '(Fixnum) -> Fixnum'
26
- type 'self.groups', '() -> Array<Fixnum>'
27
- type 'self.groups=', '(Array<Fixnum>) -> Array<Fixnum>'
28
- type 'self.initgroups', '(String username, Fixnum gid) -> Array<Fixnum>'
29
- type 'self.kill', '(Fixnum or Symbol or String signal, *Fixnum pids) -> Fixnum'
30
- type 'self.maxgroups', '() -> Fixnum'
31
- type 'self.maxgroups=', '(Fixnum) -> Fixnum'
32
- type 'self.pid', '() -> Fixnum'
33
- type 'self.ppid', '() -> Fixnum'
34
- type 'self.pgid', '(Fixnum pid, Fixnum) -> Fixnum'
35
- type 'self.setpriority', '(Fixnum kind, Fixnum, Fixnum priority) -> 0'
36
- type 'self.setproctitle', '(String) -> String'
37
- type 'self.setrlimit', '(Symbol or String or Fixnum resource, Fixnum cur_limit, ?Fixnum max_limit) -> nil'
38
- type 'self.setsid', '() -> Fixnum'
39
- # type 'self.spawn', '(?Hash<String, String> env, String command, *String args) -> %any' # TODO: env
40
- type 'self.times', '() -> Process::Tms'
41
- type 'self.uid', '() -> Fixnum'
42
- type 'self.uid=', '(Fixnum user) -> Fixnum'
43
- type 'self.wait', '(?Fixnum pid, ?Fixnum flags) -> Fixnum'
44
- type 'self.wait2', '(?Fixnum pid, ?Fixnum flags) -> [Fixnum, Fixnum] pid_and_status'
45
- type 'self.waitall', '() -> Array<[Fixnum, Fixnum]>'
46
- type 'self.waitpid', '(?Fixnum pid, ?Fixnum flags) -> Fixnum'
47
- type 'self.waitpid2', '(?Fixnum pid, ?Fixnum flags) -> [Fixnum, Fixnum] pid_and_status'
48
-
49
- module GID
50
- rdl_nowrap
51
-
52
- type 'self.change_privilege', '(Fixnum group) -> Fixnum'
53
- type 'self.eid', '() -> Fixnum'
54
- type 'self.from_name', '(String name) -> Fixnum gid'
55
- type 'self.grant_privilege', '(Fixnum group) -> Fixnum'
56
- rdl_alias 'self.eid=', 'self.grant_privilege'
57
- type 'self.re_exchange', '() -> Fixnum'
58
- type 'self.re_exchangeable?', '() -> %bool'
59
- type 'self.rid', '() -> Fixnum'
60
- type 'self.sid_available?', '() -> %bool'
61
- type 'self.switch', '() -> Fixnum'
62
- type 'self.switch', '() { () -> t } -> t'
63
- end
64
-
65
- module UID
66
- rdl_nowrap
67
-
68
- type 'self.change_privilege', '(Fixnum user) -> Fixnum'
69
- type 'self.eid', '() -> Fixnum'
70
- type 'self.from_name', '(String name) -> Fixnum uid'
71
- type 'self.grant_privilege', '(Fixnum user) -> Fixnum'
72
- rdl_alias 'self.eid=', 'self.grant_privilege'
73
- type 'self.re_exchange', '() -> Fixnum'
74
- type 'self.re_exchangeable?', '() -> %bool'
75
- type 'self.rid', '() -> Fixnum'
76
- type 'self.sid_available?', '() -> %bool'
77
- type 'self.switch', '() -> Fixnum'
78
- type 'self.switch', '() { () -> t } -> t'
79
- end
80
-
81
- class Status
82
- rdl_nowrap
83
-
84
- type :&, '(Fixnum num) -> Fixnum'
85
- type :==, '(%any other) -> %bool'
86
- type :>>, '(Fixnum num) -> Fixnum'
87
- type :coredump?, '() -> %bool'
88
- type :exited?, '() -> %bool'
89
- type :exitstatus, '() -> Fixnum or nil'
90
- type :inspect, '() -> String'
91
- type :pid, '() -> Fixnum'
92
- type :signaled?, '() -> %bool'
93
- type :stopped?, '() -> %bool'
94
- type :stopsig, '() -> Fixnum or nil'
95
- type :success?, '() -> %bool'
96
- type :termsig, '() -> Fixnum or nil'
97
- type :to_i, '() -> Fixnum'
98
- rdl_alias :to_int, :to_i
99
- type :to_s, '() -> String'
100
- end
101
-
102
- module Sys
103
- rdl_nowrap
104
-
105
- type 'self.geteid', '() -> Fixnum'
106
- type 'self.geteuid', '() -> Fixnum'
107
- type 'self.getgid', '() -> Fixnum'
108
- type 'self.getuid', '() -> Fixnum'
109
- type 'self.issetugid', '() -> %bool'
110
- type 'self.setegid', '(Fixnum group) -> nil'
111
- type 'self.seteuid', '(Fixnum user) -> nil'
112
- type 'self.setgid', '(Fixnum group) -> nil'
113
- type 'self.setregid', '(Fixnum rid, Fixnum eid) -> nil'
114
- type 'self.setresgid', '(Fixnum rid, Fixnum eid, Fixnum sid) -> nil'
115
- type 'self.setresuid', '(Fixnum rid, Fixnum eid, Fixnum sid) -> nil'
116
- type 'self.setreuid', '(Fixnum rid, Fixnum eid) -> nil'
117
- type 'self.setrgid', '(Fixnum group) -> nil'
118
- type 'self.setruid', '(Fixnum user) -> nil'
119
- type 'self.setuid', '(Fixnum user) -> nil'
120
- end
121
-
122
- class Waiter
123
- rdl_nowrap
124
-
125
- type 'pid', '() -> Fixnum'
126
- end
127
- end