rdl 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,13 @@
1
+ RDL.nowrap :Random
2
+
3
+ RDL.type :Random, :initialize, '(?Integer seed) -> self' # Floats can be passed also, but just truncated to int?
4
+ RDL.type :Random, 'self.new_seed', '() -> Integer'
5
+ RDL.type :Random, 'self.rand', '(?Integer max) -> Numeric'
6
+ RDL.type :Random, 'self.srand', '(?Integer number) -> Numeric old_seed'
7
+
8
+ RDL.type :Random, :==, '(%any) -> %bool'
9
+ RDL.type :Random, :bytes, '(Integer size) -> String'
10
+ RDL.type :Random, :rand, '(?(Integer or Range<Integer>) max) -> Integer'
11
+ RDL.type :Random, :rand, '(?(Float or Range<Float>) max) -> Float'
12
+ RDL.pre(:Random, :rand) { |max| max > 0 }
13
+ RDL.type :Random, :seed, '() -> Integer'
@@ -0,0 +1,37 @@
1
+ RDL.nowrap :Range
2
+
3
+ # Range is immutable, so covariant
4
+ RDL.type_params(:Range, [:t], nil, variance: [:+]) { |t| t.member?(self.begin) && t.member?(self.end) } # TODO: And instantiated if t instantiated
5
+
6
+ # TODO: Parse error
7
+ #RDL.type :Range, :Range, 'self.new', '(begin: [<=> : (u, u) -> Integer], end: [<=>, (u, u) -> Integer], exclude_end: ?%bool) -> Range<u>'
8
+ RDL.type :Range, :==, '(%any obj) -> %bool'
9
+ RDL.type :Range, :===, '(%any obj) -> %bool'
10
+ RDL.type :Range, :begin, '() -> t'
11
+ RDL.type :Range, :bsearch, '() { (t) -> %bool } -> u or nil'
12
+ RDL.type :Range, :cover?, '(%any obj) -> %bool'
13
+ RDL.type :Range, :each, '() { (t) -> %any } -> self'
14
+ RDL.type :Range, :each, '() -> Enumerator<t>'
15
+ RDL.type :Range, :end, '() -> t'
16
+ RDL.rdl_alias :Range, :eql?, :==
17
+ RDL.type :Range, :exclude_end?, '() -> %bool'
18
+ RDL.type :Range, :first, '() -> t'
19
+ RDL.type :Range, :first, '(Integer n) -> Array<t>'
20
+ RDL.type :Range, :hash, '() -> Integer'
21
+ RDL.type :Range, :include?, '(%any obj) -> %bool'
22
+ RDL.type :Range, :inspect, '() -> String'
23
+ RDL.type :Range, :last, '() -> t'
24
+ RDL.type :Range, :last, '(Integer n) -> Array<t>'
25
+ RDL.type :Range, :max, '() -> t'
26
+ RDL.type :Range, :max, '() { (t, t) -> Integer } -> t'
27
+ RDL.type :Range, :max, '(Integer n) -> Array<t>'
28
+ RDL.type :Range, :max, '(Integer n) { (t, t) -> Integer } -> Array<t>'
29
+ RDL.rdl_alias :Range, :member?, :include
30
+ RDL.type :Range, :min, '() -> t'
31
+ RDL.type :Range, :min, '() { (t, t) -> Integer } -> t'
32
+ RDL.type :Range, :min, '(Integer n) -> Array<t>'
33
+ RDL.type :Range, :min, '(Integer n) { (t, t) -> Integer } -> Array<t>'
34
+ RDL.type :Range, :size, '() -> Integer or nil'
35
+ RDL.type :Range, :step, '(?Integer n) { (t) -> %any } -> self'
36
+ RDL.type :Range, :step, '(?Integer n) -> Enumerator<t>'
37
+ RDL.type :Range, :to_s, '() -> String'
@@ -0,0 +1,207 @@
1
+ RDL.nowrap :Rational
2
+
3
+ RDL.type :Rational, :%, '(Integer) -> Rational'
4
+ RDL.pre(:Rational, :%) { |x| x!=0}
5
+ RDL.type :Rational, :%, '(Float) -> Float'
6
+ RDL.pre(:Rational, :%) { |x| x!=0&&!x.nan?}
7
+ RDL.type :Rational, :%, '(Rational) -> Rational'
8
+ RDL.pre(:Rational, :%) { |x| x!=0}
9
+ RDL.type :Rational, :%, '(BigDecimal) -> BigDecimal'
10
+ RDL.pre(:Rational, :%) { |x| x!=0&&!x.nan?}
11
+
12
+ RDL.type :Rational, :*, '(Integer) -> Rational'
13
+ RDL.type :Rational, :*, '(Float) -> Float'
14
+ RDL.type :Rational, :*, '(Rational) -> Rational'
15
+ RDL.type :Rational, :*, '(BigDecimal) -> BigDecimal'
16
+ RDL.type :Rational, :*, '(Complex) -> Complex'
17
+ RDL.pre(:Rational, :*) { |x| if (x.real.is_a?(BigDecimal)||x.imaginary.is_a?(BigDecimal)) then (if x.real.is_a?(Float) then (x.real!=Float::INFINITY && !(x.real.nan?)) elsif(x.imaginary.is_a?(Float)) then x.imaginary!=Float::INFINITY && !(x.imaginary.nan?) else true end) else true end} #can't have a complex with part BigDecimal, other part infinity/NAN
18
+
19
+ RDL.type :Rational, :+, '(Integer) -> Rational'
20
+ RDL.type :Rational, :+, '(Float) -> Float'
21
+ RDL.type :Rational, :+, '(Rational) -> Rational'
22
+ RDL.type :Rational, :+, '(BigDecimal) -> BigDecimal'
23
+ RDL.type :Rational, :+, '(Complex) -> Complex'
24
+
25
+ RDL.type :Rational, :-, '(Integer) -> Rational'
26
+ RDL.type :Rational, :-, '(Float) -> Float'
27
+ RDL.type :Rational, :-, '(Rational) -> Rational'
28
+ RDL.type :Rational, :-, '(BigDecimal) -> BigDecimal'
29
+ RDL.type :Rational, :-, '(Complex) -> Complex'
30
+
31
+ RDL.type :Rational, :-@, '() -> Rational'
32
+
33
+ RDL.type :Rational, :+@, '() -> Rational'
34
+
35
+ RDL.type :Rational, :**, '(Integer) -> %numeric'
36
+ RDL.type :Rational, :**, '(Float) -> %numeric'
37
+ RDL.type :Rational, :**, '(Rational) -> %numeric'
38
+ RDL.type :Rational, :**, '(BigDecimal) -> BigDecimal'
39
+ RDL.pre(:Rational, :**) { |x| x!=BigDecimal::INFINITY && if self<0 then x<=-1||x>=0 else true end}
40
+ RDL.post(:Rational, :**) { |r,x| r.real?}
41
+ RDL.type :Rational, :**, '(Complex) -> Complex'
42
+ RDL.pre(:Rational, :**) { |x| x!=0 && if (x.real.is_a?(BigDecimal)||x.imaginary.is_a?(BigDecimal)) then (if x.real.is_a?(Float) then (x.real!=Float::INFINITY && !(x.real.nan?)) elsif(x.imaginary.is_a?(Float)) then x.imaginary!=Float::INFINITY && !(x.imaginary.nan?) else true end) else true end}
43
+
44
+ RDL.type :Rational, :/, '(Integer) -> Rational'
45
+ RDL.pre(:Rational, :/) { |x| x!=0}
46
+ RDL.type :Rational, :/, '(Float) -> Float'
47
+ RDL.pre(:Rational, :/) { |x| x!=0}
48
+ RDL.type :Rational, :/, '(Rational) -> Rational'
49
+ RDL.pre(:Rational, :/) { |x| x!=0}
50
+ RDL.type :Rational, :/, '(BigDecimal) -> BigDecimal'
51
+ RDL.pre(:Rational, :/) { |x| x!=0}
52
+ RDL.type :Rational, :/, '(Complex) -> Complex'
53
+ RDL.pre(:Rational, :/) { |x| x!=0 && if (x.real.is_a?(BigDecimal)||x.imaginary.is_a?(BigDecimal)) then (if x.real.is_a?(Float) then (x.real!=Float::INFINITY && !(x.real.nan?)) elsif(x.imaginary.is_a?(Float)) then x.imaginary!=Float::INFINITY && !(x.imaginary.nan?) else true end) else true end && if (x.real.is_a?(Rational) && x.imaginary.is_a?(Float)) then !x.imaginary.nan? else true end}
54
+
55
+ RDL.type :Rational, :<, '(Integer) -> %bool'
56
+ RDL.type :Rational, :<, '(Float) -> %bool'
57
+ RDL.pre(:Rational, :<) { |x| !x.nan?}
58
+ RDL.type :Rational, :<, '(Rational) -> %bool'
59
+ RDL.type :Rational, :<, '(BigDecimal) -> %bool'
60
+ RDL.pre(:Rational, :<) { |x| !x.nan?}
61
+
62
+ RDL.type :Rational, :<=, '(Integer) -> %bool'
63
+ RDL.type :Rational, :<=, '(Float) -> %bool'
64
+ RDL.pre(:Rational, :<=) { |x| !x.nan?}
65
+ RDL.type :Rational, :<=, '(Rational) -> %bool'
66
+ RDL.type :Rational, :<=, '(BigDecimal) -> %bool'
67
+ RDL.pre(:Rational, :<=) { |x| !x.nan?}
68
+
69
+ RDL.type :Rational, :>, '(Integer) -> %bool'
70
+ RDL.type :Rational, :>, '(Float) -> %bool'
71
+ RDL.pre(:Rational, :>) { |x| !x.nan?}
72
+ RDL.type :Rational, :>, '(Rational) -> %bool'
73
+ RDL.type :Rational, :>, '(BigDecimal) -> %bool'
74
+ RDL.pre(:Rational, :>) { |x| !x.nan?}
75
+
76
+ RDL.type :Rational, :>=, '(Integer) -> %bool'
77
+ RDL.type :Rational, :>=, '(Float) -> %bool'
78
+ RDL.pre(:Rational, :>=) { |x| !x.nan?}
79
+ RDL.type :Rational, :>=, '(Rational) -> %bool'
80
+ RDL.type :Rational, :>=, '(BigDecimal) -> %bool'
81
+ RDL.pre(:Rational, :>=) { |x| !x.nan?}
82
+
83
+ RDL.type :Rational, :<=>, '(Integer) -> Object'
84
+ RDL.post(:Rational, :<=>) { |r,x| r == -1 || r==0 || r==1}
85
+ RDL.type :Rational, :<=>, '(Float) -> Object'
86
+ RDL.post(:Rational, :<=>) { |r,x| r == -1 || r==0 || r==1}
87
+ RDL.type :Rational, :<=>, '(Rational) -> Object'
88
+ RDL.post(:Rational, :<=>) { |r,x| r == -1 || r==0 || r==1}
89
+ RDL.type :Rational, :<=>, '(BigDecimal) -> Object'
90
+ RDL.post(:Rational, :<=>) { |r,x| r == -1 || r==0 || r==1}
91
+
92
+ RDL.type :Rational, :==, '(Object) -> %bool'
93
+
94
+ RDL.type :Rational, :abs, '() -> Rational'
95
+ RDL.post(:Rational, :abs) { |r,x| r >= 0 }
96
+
97
+ RDL.type :Rational, :abs2, '() -> Rational'
98
+ RDL.post(:Rational, :abs2) { |r,x| r >= 0 }
99
+
100
+ RDL.type :Rational, :angle, '() -> %numeric'
101
+ RDL.post(:Rational, :angle) { |r,x| r == 0 || r == Math::PI}
102
+
103
+ RDL.type :Rational, :arg, '() -> %numeric'
104
+ RDL.post(:Rational, :arg) { |r,x| r == 0 || r == Math::PI}
105
+
106
+ RDL.type :Rational, :div, '(Integer) -> Integer'
107
+ RDL.pre(:Rational, :div) { |x| x!=0}
108
+ RDL.type :Rational, :div, '(Float) -> Integer'
109
+ RDL.pre(:Rational, :div) { |x| x!=0 && !x.nan?}
110
+ RDL.type :Rational, :div, '(Rational) -> Integer'
111
+ RDL.pre(:Rational, :div) { |x| x!=0}
112
+ RDL.type :Rational, :div, '(BigDecimal) -> Integer'
113
+ RDL.pre(:Rational, :div) { |x| x!=0 && !x.nan?}
114
+
115
+ RDL.type :Rational, :modulo, '(Integer) -> Rational'
116
+ RDL.pre(:Rational, :modulo) { |x| x!=0}
117
+ RDL.type :Rational, :modulo, '(Float) -> Float'
118
+ RDL.pre(:Rational, :modulo) { |x| x!=0&&!x.nan?}
119
+ RDL.type :Rational, :modulo, '(Rational) -> Rational'
120
+ RDL.pre(:Rational, :modulo) { |x| x!=0}
121
+ RDL.type :Rational, :modulo, '(BigDecimal) -> BigDecimal'
122
+ RDL.pre(:Rational, :modulo) { |x| x!=0&&!x.nan?}
123
+
124
+ RDL.type :Rational, :ceil, '() -> Integer'
125
+ RDL.type :Rational, :ceil, '(Integer) -> %numeric'
126
+
127
+ RDL.type :Rational, :denominator, '() -> Integer'
128
+ RDL.post(:Rational, :denominator) { |r,x| r > 0 }
129
+
130
+ RDL.type :Rational, :divmod, '(%real) -> [%real, %real]'
131
+ RDL.pre(:Rational, :divmod) { |x| x!=0 && if x.is_a?(BigDecimal) then !x.nan? else true end}
132
+
133
+ RDL.type :Rational, :equal?, '(Object) -> %bool'
134
+
135
+ RDL.type :Rational, :fdiv, '(Integer) -> Float'
136
+ RDL.type :Rational, :fdiv, '(Float) -> Float'
137
+ RDL.type :Rational, :fdiv, '(Rational) -> Float'
138
+ RDL.type :Rational, :fdiv, '(BigDecimal) -> Float'
139
+ RDL.type :Rational, :fdiv, '(Complex) -> Float'
140
+ RDL.pre(:Rational, :fdiv) { |x| x.imaginary==0 && x.real.class != Float}
141
+
142
+ RDL.type :Rational, :floor, '() -> Integer'
143
+
144
+ RDL.type :Rational, :floor, '(Integer) -> %numeric'
145
+
146
+ RDL.type :Rational, :hash, '() -> Integer'
147
+
148
+ RDL.type :Rational, :inspect, '() -> String'
149
+
150
+ RDL.type :Rational, :numerator, '() -> Integer'
151
+
152
+ RDL.type :Rational, :phase, '() -> %numeric'
153
+
154
+ RDL.type :Rational, :quo, '(Integer) -> Rational'
155
+ RDL.pre(:Rational, :quo) { |x| x!=0}
156
+ RDL.type :Rational, :quo, '(Float) -> Float'
157
+ RDL.pre(:Rational, :quo) { |x| x!=0}
158
+ RDL.type :Rational, :quo, '(Rational) -> Rational'
159
+ RDL.pre(:Rational, :quo) { |x| x!=0}
160
+ RDL.type :Rational, :quo, '(BigDecimal) -> BigDecimal'
161
+ RDL.pre(:Rational, :quo) { |x| x!=0}
162
+ RDL.type :Rational, :quo, '(Complex) -> Complex'
163
+ RDL.pre(:Rational, :quo) { |x| x!=0 && if (x.real.is_a?(BigDecimal)||x.imaginary.is_a?(BigDecimal)) then (if x.real.is_a?(Float) then (x.real!=Float::INFINITY && !(x.real.nan?)) elsif(x.imaginary.is_a?(Float)) then x.imaginary!=Float::INFINITY && !(x.imaginary.nan?) else true end) else true end && if (x.real.is_a?(Rational) && x.imaginary.is_a?(Float)) then !x.imaginary.nan? else true end}
164
+
165
+ RDL.type :Rational, :rationalize, '() -> Rational'
166
+
167
+ RDL.type :Rational, :rationalize, '(%numeric) -> Rational'
168
+ RDL.pre(:Rational, :quo) { |x| if x.is_a?(Float) then x!=Float::INFINITY && !x.nan? else true end}
169
+
170
+ RDL.type :Rational, :round, '() -> Integer'
171
+
172
+ RDL.type :Rational, :round, '(Integer) -> %numeric'
173
+
174
+ RDL.type :Rational, :to_f, '() -> Float'
175
+ RDL.pre(:Rational, :to_f) { self<=Float::MAX}
176
+
177
+ RDL.type :Rational, :to_i, '() -> Integer'
178
+
179
+ RDL.type :Rational, :to_r, '() -> Rational'
180
+
181
+ RDL.type :Rational, :to_s, '() -> String'
182
+
183
+ RDL.type :Rational, :truncate, '() -> Integer'
184
+
185
+ RDL.type :Rational, :truncate, '(Integer) -> Rational'
186
+
187
+ RDL.type :Rational, :zero?, '() -> %bool'
188
+
189
+ RDL.type :Rational, :conj, '() -> Rational'
190
+ RDL.type :Rational, :conjugate, '() -> Rational'
191
+
192
+ RDL.type :Rational, :imag, '() -> Integer'
193
+ RDL.post(:Rational, :imag) { |r,x| r == 0 }
194
+ RDL.type :Rational, :imaginary, '() -> Integer'
195
+ RDL.post(:Rational, :imaginary) { |r,x| r == 0 }
196
+
197
+ RDL.type :Rational, :real, '() -> Rational'
198
+
199
+ RDL.type :Rational, :real?, '() -> true'
200
+
201
+ RDL.type :Rational, :to_c, '() -> Complex'
202
+ RDL.post(:Rational, :to_c) { |r,x| r.imaginary == 0 }
203
+
204
+ RDL.type :Rational, :coerce, '(Integer) -> [Rational, Rational]'
205
+ RDL.type :Rational, :coerce, '(Float) -> [Float, Float]'
206
+ RDL.type :Rational, :coerce, '(Rational) -> [Rational, Rational]'
207
+ RDL.type :Rational, :coerce, '(Complex) -> [%numeric, %numeric]'
@@ -0,0 +1,28 @@
1
+ RDL.nowrap :Regexp
2
+
3
+ RDL.type :Regexp, 'self.escape', '(String or Symbol) -> String'
4
+ RDL.type :Regexp, 'self.last_match', '() -> MatchData', wrap: false # Can't wrap or messes up MatchData
5
+ RDL.type :Regexp, 'self.last_match', '(Integer) -> String', wrap: false
6
+ RDL.type :Regexp, :initialize, '(String, ?%any options, ?String kcode) -> self'
7
+ RDL.type :Regexp, :initialize, '(Regexp) -> self'
8
+ RDL.rdl_alias :Regexp, 'self.compile', 'self.new'
9
+ RDL.rdl_alias :Regexp, 'self.quote', 'self.escape'
10
+ RDL.type :Regexp, 'self.try_convert', '(%any obj) -> Regexp or nil'
11
+ RDL.type :Regexp, 'self.union', '(*(Regexp or String) pats) -> Regexp'
12
+ RDL.type :Regexp, 'self.union', '(Array<Regexp or String> pats) -> Regexp'
13
+ RDL.type :Regexp, :==, '(%any other) -> %bool'
14
+ RDL.type :Regexp, :===, '(%any other) -> %bool', wrap: false # Can't wrap this of it messes with $1, $2, etc as well!
15
+ RDL.type :Regexp, :=~, '(String str) -> Integer or nil', wrap: false # Can't wrap this or it will mess with $1, $2, etc
16
+ RDL.type :Regexp, :casefold?, '() -> %bool'
17
+ RDL.type :Regexp, :encoding, '() -> Encoding'
18
+ RDL.rdl_alias :Regexp, :eql?, :==
19
+ RDL.type :Regexp, :fixed_encoding?, '() -> %bool'
20
+ RDL.type :Regexp, :hash, '() -> Integer'
21
+ RDL.type :Regexp, :inspect, '() -> String'
22
+ RDL.type :Regexp, :match, '(String, ?Integer) -> MatchData or nil'
23
+ RDL.type :Regexp, :named_captures, '() -> Hash<String, Array<Integer>>'
24
+ RDL.type :Regexp, :names, '() -> Array<String>'
25
+ RDL.type :Regexp, :options, '() -> Integer'
26
+ RDL.type :Regexp, :source, '() -> String'
27
+ RDL.type :Regexp, :to_s, '() -> String'
28
+ RDL.type :Regexp, :~, '() -> Integer or nil'
@@ -0,0 +1,56 @@
1
+ RDL.nowrap :Set
2
+
3
+ RDL.type_params :Set, [:t], :all?
4
+
5
+ RDL.type :Set, 'self.[]', '(*u) -> Set<u>'
6
+ RDL.type :Set, :initialize, '(?Enumerable<u> enum) -> self<u>'
7
+
8
+ RDL.rdl_alias :Set, :&, :intersection
9
+ RDL.type :Set, :+, '(Enumerable<t> enum) -> Set<t>'
10
+ RDL.rdl_alias :Set, :-, :difference
11
+ RDL.rdl_alias :Set, :<, :proper_subset?
12
+ RDL.rdl_alias :Set, :<<, :add
13
+ RDL.rdl_alias :Set, :<=, :subset?
14
+ RDL.rdl_alias :Set, :>, :proper_superset?
15
+ RDL.rdl_alias :Set, :>=, :superset?
16
+ RDL.type :Set, :^, '(Enumerable<t> enum) -> Set<t>'
17
+ RDL.type :Set, :add, '(t o) -> self'
18
+ RDL.type :Set, :add?, '(t o) -> self or nil'
19
+ RDL.type :Set, :classify, '() { (u) -> t } -> Hash<u, Set<t>>'
20
+ RDL.type :Set, :clear, '() -> self'
21
+ RDL.rdl_alias :Set, :collect!, :map
22
+ RDL.type :Set, :delete, '(t o) -> self'
23
+ RDL.type :Set, :delete?, '(t o) -> self or nil'
24
+ RDL.type :Set, :delete_if, '() { (t) -> %bool } -> self'
25
+ RDL.type :Set, :difference, '(Enumerable<t> enum) -> Set<t>'
26
+ RDL.type :Set, :disjoint?, '(Set<t> set) -> %bool'
27
+ #??RDL.type :Set, :divide, '() { BLOCK }'
28
+ RDL.type :Set, :each, '() { (t) -> %any } -> self'
29
+ RDL.type :Set, :each, '() -> Enumerator<t>'
30
+ RDL.type :Set, :empty?, '() -> %bool'
31
+ RDL.type :Set, :flatten!, '() -> self or nil'
32
+ RDL.post(:Set, :flatten!) { |r| (not r) || (r.none? { |x| x.is_a?(Set) }) }
33
+ RDL.type :Set, :flatten, '() -> Set'
34
+ RDL.post(:Set, :flatten) { |r| r.none? { |x| x.is_a?(Set) } }
35
+ # RDL.type :Set, :flatten_merge, '(set : XXXX, seen : ?XXXX)' #??
36
+ RDL.rdl_alias :Set, :include?, :member?
37
+ RDL.type :Set, :intersect?, '(Set<t> set) -> %bool'
38
+ RDL.type :Set, :intersection, '(Enumerable<t> enum) -> Set<t>'
39
+ RDL.type :Set, :keep_if, '() { (t) -> %bool } -> self'
40
+ RDL.rdl_alias :Set, :length, :size
41
+ RDL.type :Set, :map!, '() { (t) -> u } -> Set<u>' # !! Fix, actually changes RDL.type!
42
+ RDL.type :Set, :member?, '(t o) -> %bool'
43
+ RDL.type :Set, :merge, '(Enumerable<t> enum) -> self'
44
+ RDL.type :Set, :proper_subset?, '(Set<t> set) -> %bool'
45
+ RDL.type :Set, :proper_superset?, '(Set<t> set) -> %bool'
46
+ RDL.type :Set, :reject!, '() { (t) -> %bool } -> self or nil'
47
+ RDL.type :Set, :replace, '(Enumerable<u> enum) -> Set<u>' # !! Fix, actually changes RDL.type!
48
+ RDL.type :Set, :select!, '() { (t) -> %bool } -> self or nil'
49
+ RDL.type :Set, :size, '() -> Integer'
50
+ RDL.type :Set, :subset?, '(Set<t> set) -> %bool'
51
+ RDL.type :Set, :subtract, '(Enumerable<t> enum) -> self'
52
+ RDL.type :Set, :superset?, '(Set<t> set) -> %bool'
53
+ RDL.type :Set, :to_a, '() -> Array<t>'
54
+ #RDL.type :Set, :to_set, '(klass: ?Class, args : *XXXX) { BLOCK }' # ??
55
+ RDL.rdl_alias :Set, :|, :+
56
+ RDL.rdl_alias :Set, :union, :+
@@ -0,0 +1,140 @@
1
+ RDL.nowrap :String
2
+ RDL.type :String, :initialize, '(?String str) -> self new_str'
3
+ RDL.type :String, :try_convert, '(Object obj) -> String or nil new_string'
4
+ RDL.type :String, :%, '(Object) -> String'
5
+ RDL.type :String, :*, '(Integer) -> String'
6
+ RDL.type :String, :+, '(String) -> String'
7
+ RDL.type :String, :<<, '(Object) -> String'
8
+ RDL.type :String, :<=>, '(String other) -> Integer or nil ret'
9
+ RDL.type :String, :==, '(%any) -> %bool'
10
+ RDL.type :String, :===, '(%any) -> %bool'
11
+ RDL.type :String, :=~, '(Object) -> Integer or nil', wrap: false # Wrapping this messes up $1 etc
12
+ RDL.type :String, :[], '(Integer, ?Integer) -> String or nil'
13
+ RDL.type :String, :[], '(Range<Integer> or Regexp) -> String or nil'
14
+ RDL.type :String, :[], '(Regexp, Integer) -> String or nil'
15
+ RDL.type :String, :[], '(Regexp, String) -> String or nil'
16
+ RDL.type :String, :[], '(String) -> String or nil'
17
+ RDL.type :String, :ascii_only?, '() -> %bool'
18
+ RDL.type :String, :b, '() -> String'
19
+ RDL.type :String, :bytes, '() -> Array' # TODO: bindings to parameterized (vars)
20
+ RDL.type :String, :bytesize, '() -> Integer'
21
+ RDL.type :String, :byteslice, '(Integer, ?Integer) -> String or nil'
22
+ RDL.type :String, :byteslice, '(Range<Integer>) -> String or nil'
23
+ RDL.type :String, :capitalize, '() -> String'
24
+ RDL.type :String, :capitalize!, '() -> String or nil'
25
+ RDL.type :String, :casecmp, '(String) -> nil or Integer'
26
+ RDL.type :String, :center, '(Integer, ?String) -> String'
27
+ RDL.type :String, :chars, '() -> Array' #deprecated
28
+ RDL.type :String, :chomp, '(?String) -> String'
29
+ RDL.type :String, :chomp!, '(?String) -> String or nil'
30
+ RDL.type :String, :chop, '() -> String'
31
+ RDL.type :String, :chop!, '() -> String or nil'
32
+ RDL.type :String, :chr, '() -> String'
33
+ RDL.type :String, :clear, '() -> String'
34
+ RDL.type :String, :codepoints, '() -> Array<Integer>' # TODO
35
+ RDL.type :String, :codepoints, '() {(?%any) -> %any} -> Array<Integer>' # TODO
36
+ RDL.type :String, :concat, '(Integer or Object) -> String'
37
+ RDL.type :String, :count, '(String, *String) -> Integer'
38
+ RDL.type :String, :crypt, '(String) -> String'
39
+ RDL.type :String, :delete, '(String, *String) -> String'
40
+ RDL.type :String, :delete!, '(String, *String) -> String or nil'
41
+ RDL.type :String, :downcase, '() -> String'
42
+ RDL.type :String, :downcase!, '() -> String or nil'
43
+ RDL.type :String, :dump, '() -> String'
44
+ RDL.type :String, :each_byte, '() {(Integer) -> %any} -> String'
45
+ RDL.type :String, :each_byte, '() -> Enumerator'
46
+ RDL.type :String, :each_char, '() {(String) -> %any} -> String'
47
+ RDL.type :String, :each_char, '() -> Enumerator'
48
+ RDL.type :String, :each_codepoint, '() {(Integer) -> %any} -> String'
49
+ RDL.type :String, :each_codepoint, '() -> Enumerator'
50
+ RDL.type :String, :each_line, '(?String) {(Integer) -> %any} -> String'
51
+ RDL.type :String, :each_line, '(?String) -> Enumerator'
52
+ RDL.type :String, :empty?, '() -> %bool'
53
+ # RDL.type :String, :encode, '(?Encoding, ?Encoding, *Symbol) -> String' # TODO: fix Hash arg:String,
54
+ # RDL.type :String, :encode!, '(Encoding, ?Encoding, *Symbol) -> String'
55
+ RDL.type :String, :encoding, '() -> Encoding'
56
+ RDL.type :String, :end_with?, '(*String) -> %bool'
57
+ RDL.type :String, :eql?, '(String) -> %bool'
58
+ RDL.type :String, :force_encoding, '(String or Encoding) -> String'
59
+ RDL.type :String, :getbyte, '(Integer) -> Integer or nil'
60
+ RDL.type :String, :gsub, '(Regexp or String, String) -> String', wrap: false # Can't wrap these:String, , since they mess with $1 etc
61
+ RDL.type :String, :gsub, '(Regexp or String, Hash) -> String', wrap: false
62
+ RDL.type :String, :gsub, '(Regexp or String) {(String) -> %any } -> String', wrap: false
63
+ RDL.type :String, :gsub, '(Regexp or String) -> Enumerator', wrap: false
64
+ RDL.type :String, :gsub, '(Regexp or String) -> String', wrap: false
65
+ RDL.type :String, :gsub!, '(Regexp or String, String) -> String or nil', wrap: false
66
+ RDL.type :String, :gsub!, '(Regexp or String) {(String) -> %any } -> String or nil', wrap: false
67
+ RDL.type :String, :gsub!, '(Regexp or String) -> Enumerator', wrap: false
68
+ RDL.type :String, :hash, '() -> Integer'
69
+ RDL.type :String, :hex, '() -> Integer'
70
+ RDL.type :String, :include?, '(String) -> %bool'
71
+ RDL.type :String, :index, '(Regexp or String, ?Integer) -> Integer or nil'
72
+ RDL.type :String, :replace, '(String) -> String'
73
+ RDL.type :String, :insert, '(Integer, String) -> String'
74
+ RDL.type :String, :inspect, '() -> String'
75
+ RDL.type :String, :intern, '() -> Symbol'
76
+ RDL.type :String, :length, '() -> Integer'
77
+ RDL.type :String, :lines, '(?String) -> Array<String>'
78
+ RDL.type :String, :ljust, '(Integer, ?String) -> String' # TODO
79
+ RDL.type :String, :lstrip, '() -> String'
80
+ RDL.type :String, :lstrip!, '() -> String or nil'
81
+ RDL.type :String, :match, '(Regexp or String) -> MatchData'
82
+ RDL.type :String, :match, '(Regexp or String, Integer) -> MatchData'
83
+ RDL.type :String, :next, '() -> String'
84
+ RDL.type :String, :next!, '() -> String'
85
+ RDL.type :String, :oct, '() -> Integer'
86
+ RDL.type :String, :ord, '() -> Integer'
87
+ RDL.type :String, :partition, '(Regexp or String) -> Array<String>'
88
+ RDL.type :String, :prepend, '(String) -> String'
89
+ RDL.type :String, :reverse, '() -> String'
90
+ RDL.type :String, :rindex, '(String or Regexp, ?Integer) -> Integer or nil' # TODO
91
+ RDL.type :String, :rjust, '(Integer, ?String) -> String' # TODO
92
+ RDL.type :String, :rpartition, '(String or Regexp) -> Array<String>'
93
+ RDL.type :String, :rstrip, '() -> String'
94
+ RDL.type :String, :rstrip!, '() -> String'
95
+ RDL.type :String, :scan, '(Regexp or String) -> Array<String or Array<String>>', wrap: false # :String, Can't wrap or screws up last_match
96
+ RDL.type :String, :scan, '(Regexp or String) {(*%any) -> %any} -> Array<String or Array<String>>', wrap: false
97
+ RDL.type :String, :scrub, '(?String) -> String'
98
+ RDL.type :String, :scrub, '(?String) {(%any) -> %any} -> String'
99
+ RDL.type :String, :scrub!, '(?String) -> String'
100
+ RDL.type :String, :scrub!, '(?String) {(%any) -> %any} -> String'
101
+ RDL.type :String, :set_byte, '(Integer, Integer) -> Integer'
102
+ RDL.type :String, :size, '() -> Integer'
103
+ RDL.rdl_alias :String, :slice, :[]
104
+ RDL.type :String, :slice!, '(Integer, ?Integer) -> String or nil'
105
+ RDL.type :String, :slice!, '(Range<Integer> or Regexp) -> String or nil'
106
+ RDL.type :String, :slice!, '(Regexp, Integer) -> String or nil'
107
+ RDL.type :String, :slice!, '(Regexp, String) -> String or nil'
108
+ RDL.type :String, :slice!, '(String) -> String or nil'
109
+ RDL.type :String, :split, '(?(Regexp or String), ?Integer) -> Array<String>'
110
+ RDL.type :String, :split, '(?Integer) -> Array<String>'
111
+ RDL.type :String, :squeeze, '(?String) -> String'
112
+ RDL.type :String, :squeeze!, '(?String) -> String'
113
+ RDL.type :String, :start_with?, '(* String) -> %bool'
114
+ RDL.type :String, :strip, '() -> String'
115
+ RDL.type :String, :strip!, '() -> String'
116
+ RDL.type :String, :sub, '(Regexp or String, String or Hash) -> String', wrap: false # Can't wrap these, since they mess with $1 etc
117
+ RDL.type :String, :sub, '(Regexp or String) {(String) -> %any} -> String', wrap: false
118
+ RDL.type :String, :sub!, '(Regexp or String, String) -> String', wrap: false # TODO: Does this really not allow Hash?
119
+ RDL.type :String, :sub!, '(Regexp or String) {(String) -> %any} -> String', wrap: false
120
+ RDL.type :String, :succ, '() -> String'
121
+ RDL.type :String, :sum, '(?Integer) -> Integer'
122
+ RDL.type :String, :swapcase, '() -> String'
123
+ RDL.type :String, :swapcase!, '() -> String or nil'
124
+ RDL.type :String, :to_c, '() -> Complex'
125
+ RDL.type :String, :to_f, '() -> Float'
126
+ RDL.type :String, :to_i, '(?Integer) -> Integer'
127
+ RDL.type :String, :to_r, '() -> Rational'
128
+ RDL.type :String, :to_s, '() -> String'
129
+ RDL.type :String, :to_str, '() -> String'
130
+ RDL.type :String, :to_sym, '() -> Symbol'
131
+ RDL.type :String, :tr, '(String, String) -> String'
132
+ RDL.type :String, :tr!, '(String, String) -> String or nil'
133
+ RDL.type :String, :tr_s, '(String, String) -> String'
134
+ RDL.type :String, :tr_s!, '(String, String) -> String or nil'
135
+ RDL.type :String, :unpack, '(String) -> Array<String>'
136
+ RDL.type :String, :upcase, '() -> String'
137
+ RDL.type :String, :upcase!, '() -> String or nil'
138
+ RDL.type :String, :upto, '(String, ?bool) -> Enumerator'
139
+ RDL.type :String, :upto, '(String, ?bool) {(String) -> %any } -> String'
140
+ RDL.type :String, :valid_encoding?, '() -> %bool'