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
@@ -17,7 +17,7 @@ class TestLe < Minitest::Test
17
17
 
18
18
  # convert arg string to a type
19
19
  def tt(t)
20
- $__rdl_parser.scan_str('#T ' + t)
20
+ RDL::Globals.parser.scan_str('#T ' + t)
21
21
  end
22
22
 
23
23
  def setup
@@ -29,49 +29,49 @@ class TestLe < Minitest::Test
29
29
  end
30
30
 
31
31
  def test_nil
32
- assert ($__rdl_nil_type <= $__rdl_top_type)
33
- assert ($__rdl_nil_type <= $__rdl_string_type)
34
- assert ($__rdl_nil_type <= $__rdl_object_type)
35
- assert ($__rdl_nil_type <= @tbasicobject)
36
- assert (not ($__rdl_nil_type <= @tsymfoo)) # nil no longer <= other singleton types
37
- assert (not ($__rdl_top_type <= $__rdl_nil_type))
38
- assert (not ($__rdl_string_type <= $__rdl_nil_type))
39
- assert (not ($__rdl_object_type <= $__rdl_nil_type))
40
- assert (not (@tbasicobject <= $__rdl_nil_type))
41
- assert (not (@tsymfoo <= $__rdl_nil_type))
32
+ assert (RDL::Globals.types[:nil] <= RDL::Globals.types[:top])
33
+ assert (RDL::Globals.types[:nil] <= RDL::Globals.types[:string])
34
+ assert (RDL::Globals.types[:nil] <= RDL::Globals.types[:object])
35
+ assert (RDL::Globals.types[:nil] <= @tbasicobject)
36
+ assert (not (RDL::Globals.types[:nil] <= @tsymfoo)) # nil no longer <= other singleton types
37
+ assert (not (RDL::Globals.types[:top] <= RDL::Globals.types[:nil]))
38
+ assert (not (RDL::Globals.types[:string] <= RDL::Globals.types[:nil]))
39
+ assert (not (RDL::Globals.types[:object] <= RDL::Globals.types[:nil]))
40
+ assert (not (@tbasicobject <= RDL::Globals.types[:nil]))
41
+ assert (not (@tsymfoo <= RDL::Globals.types[:nil]))
42
42
  end
43
43
 
44
44
  def test_top
45
- assert (not ($__rdl_top_type <= $__rdl_nil_type))
46
- assert (not ($__rdl_top_type <= $__rdl_string_type))
47
- assert (not ($__rdl_top_type <= $__rdl_object_type))
48
- assert (not ($__rdl_top_type <= @tbasicobject))
49
- assert (not ($__rdl_top_type <= @tsymfoo))
50
- assert ($__rdl_top_type <= $__rdl_top_type)
51
- assert ($__rdl_string_type <= $__rdl_top_type)
52
- assert ($__rdl_object_type <= $__rdl_top_type)
53
- assert (@tbasicobject <= $__rdl_top_type)
54
- assert (@tsymfoo <= $__rdl_top_type)
45
+ assert (not (RDL::Globals.types[:top] <= RDL::Globals.types[:nil]))
46
+ assert (not (RDL::Globals.types[:top] <= RDL::Globals.types[:string]))
47
+ assert (not (RDL::Globals.types[:top] <= RDL::Globals.types[:object]))
48
+ assert (not (RDL::Globals.types[:top] <= @tbasicobject))
49
+ assert (not (RDL::Globals.types[:top] <= @tsymfoo))
50
+ assert (RDL::Globals.types[:top] <= RDL::Globals.types[:top])
51
+ assert (RDL::Globals.types[:string] <= RDL::Globals.types[:top])
52
+ assert (RDL::Globals.types[:object] <= RDL::Globals.types[:top])
53
+ assert (@tbasicobject <= RDL::Globals.types[:top])
54
+ assert (@tsymfoo <= RDL::Globals.types[:top])
55
55
  end
56
56
 
57
57
  def test_sym
58
- assert ($__rdl_symbol_type <= $__rdl_symbol_type)
58
+ assert (RDL::Globals.types[:symbol] <= RDL::Globals.types[:symbol])
59
59
  assert (@tsymfoo <= @tsymfoo)
60
- assert (@tsymfoo <= $__rdl_symbol_type)
61
- assert (not ($__rdl_symbol_type <= @tsymfoo))
60
+ assert (@tsymfoo <= RDL::Globals.types[:symbol])
61
+ assert (not (RDL::Globals.types[:symbol] <= @tsymfoo))
62
62
  end
63
63
 
64
64
  def test_nominal
65
- assert ($__rdl_string_type <= $__rdl_string_type)
66
- assert ($__rdl_symbol_type <= $__rdl_symbol_type)
67
- assert (not ($__rdl_string_type <= $__rdl_symbol_type))
68
- assert (not ($__rdl_symbol_type <= $__rdl_string_type))
69
- assert ($__rdl_string_type <= $__rdl_object_type)
70
- assert ($__rdl_string_type <= @tbasicobject)
71
- assert ($__rdl_object_type <= @tbasicobject)
72
- assert (not ($__rdl_object_type <= $__rdl_string_type))
73
- assert (not (@tbasicobject <= $__rdl_string_type))
74
- assert (not (@tbasicobject <= $__rdl_object_type))
65
+ assert (RDL::Globals.types[:string] <= RDL::Globals.types[:string])
66
+ assert (RDL::Globals.types[:symbol] <= RDL::Globals.types[:symbol])
67
+ assert (not (RDL::Globals.types[:string] <= RDL::Globals.types[:symbol]))
68
+ assert (not (RDL::Globals.types[:symbol] <= RDL::Globals.types[:string]))
69
+ assert (RDL::Globals.types[:string] <= RDL::Globals.types[:object])
70
+ assert (RDL::Globals.types[:string] <= @tbasicobject)
71
+ assert (RDL::Globals.types[:object] <= @tbasicobject)
72
+ assert (not (RDL::Globals.types[:object] <= RDL::Globals.types[:string]))
73
+ assert (not (@tbasicobject <= RDL::Globals.types[:string]))
74
+ assert (not (@tbasicobject <= RDL::Globals.types[:object]))
75
75
  assert (@ta <= @ta)
76
76
  assert (@tb <= @ta)
77
77
  assert (@tc <= @ta)
@@ -84,55 +84,55 @@ class TestLe < Minitest::Test
84
84
  end
85
85
 
86
86
  def test_union
87
- tstring_or_sym = UnionType.new($__rdl_string_type, $__rdl_symbol_type)
88
- assert (tstring_or_sym <= $__rdl_object_type)
89
- assert (not ($__rdl_object_type <= tstring_or_sym))
87
+ tstring_or_sym = UnionType.new(RDL::Globals.types[:string], RDL::Globals.types[:symbol])
88
+ assert (tstring_or_sym <= RDL::Globals.types[:object])
89
+ assert (not (RDL::Globals.types[:object] <= tstring_or_sym))
90
90
  end
91
91
 
92
92
  def test_tuple
93
- t1 = TupleType.new($__rdl_symbol_type, $__rdl_string_type)
94
- t2 = TupleType.new($__rdl_object_type, $__rdl_object_type)
93
+ t1 = TupleType.new(RDL::Globals.types[:symbol], RDL::Globals.types[:string])
94
+ t2 = TupleType.new(RDL::Globals.types[:object], RDL::Globals.types[:object])
95
95
  tarray = NominalType.new("Array")
96
96
  assert (t1 <= t1)
97
97
  assert (t2 <= t2)
98
98
  assert (not (t2 <= t1))
99
99
  assert (not (tarray <= t1))
100
100
  assert (t1 <= t2) # covariant subtyping since tuples are *immutable*
101
- assert (tt("[1, 2, 3]") <= tt("[Fixnum, Fixnum, Fixnum]")) # covariant subtyping with singletons
102
- assert (tt("[Fixnum, Fixnum, Fixnum]") <= tt("[Object, Object, Object]"))
101
+ assert (tt("[1, 2, 3]") <= tt("[Integer, Integer, Integer]")) # covariant subtyping with singletons
102
+ assert (tt("[Integer, Integer, Integer]") <= tt("[Object, Object, Object]"))
103
103
  assert (tt("[1, 2, 3]") <= tt("[Object, Object, Object]"))
104
104
 
105
105
  # subtyping of tuples and arrays
106
- tfs_1 = tt "[Fixnum, String]"
107
- tafs_1 = tt "Array<Fixnum or String>"
106
+ tfs_1 = tt "[Integer, String]"
107
+ tafs_1 = tt "Array<Integer or String>"
108
108
  assert (tfs_1 <= tafs_1) # subtyping allowed by tfs_1 promoted to array
109
- tfs2_1 = tt "[Fixnum, String]"
109
+ tfs2_1 = tt "[Integer, String]"
110
110
  assert (not (tfs_1 <= tfs2_1)) # t12 has been promoted to array, no longer subtype
111
111
 
112
- tfs_2 = tt "[Fixnum, String]"
113
- tfs2_2 = tt "[Fixnum, String]"
112
+ tfs_2 = tt "[Integer, String]"
113
+ tfs2_2 = tt "[Integer, String]"
114
114
  assert (tfs_2 <= tfs2_2) # this is allowed here because tfs_2 is still a tuple
115
- tafs_2 = tt "Array<Fixnum or String>"
115
+ tafs_2 = tt "Array<Integer or String>"
116
116
  assert (not (tfs_2 <= tafs_2)) # subtyping not allowed because tfs_2 <= tfs2_2 unsatisfiable after tfs_2 promoted
117
117
 
118
- tfs_3 = tt "[Fixnum, String]"
118
+ tfs_3 = tt "[Integer, String]"
119
119
  tfs2_3 = tt "[Object, Object]"
120
120
  assert (tfs_3 <= tfs2_3) # this is allowed here because t12a is still a tuple
121
121
  tafs_3 = tt "Array<Object>"
122
122
  assert (not (tfs2_3 <= tafs_3)) # subtyping not allowed because tfs_3 <= tfs2_3 unsatisfiable after tfs2_3 promoted
123
123
 
124
- tfs_4 = tt "[Fixnum, String]"
125
- tfs2_4 = tt "[Fixnum, String]"
124
+ tfs_4 = tt "[Integer, String]"
125
+ tfs2_4 = tt "[Integer, String]"
126
126
  assert (tfs_4 <= tfs2_4) # allowed, types are the same
127
- tafs_4 = tt "Array<Fixnum or String>"
127
+ tafs_4 = tt "Array<Integer or String>"
128
128
  assert (tfs2_4 <= tafs_4) # allowed, both tfs2_4 and tfs_4 promoted to array
129
- tfs3_4 = tt "[Fixnum, String]"
129
+ tfs3_4 = tt "[Integer, String]"
130
130
  assert (not(tfs_4 <= tfs3_4)) # not allowed, tfs_4 has been promoted
131
131
  end
132
132
 
133
133
  def test_finite_hash
134
134
  t12 = tt "{a: 1, b: 2}"
135
- tfs = tt "{a: Fixnum, b: Fixnum}"
135
+ tfs = tt "{a: Integer, b: Integer}"
136
136
  too = tt "{a: Object, b: Object}"
137
137
  assert (t12 <= tfs)
138
138
  assert (t12 <= too)
@@ -143,36 +143,36 @@ class TestLe < Minitest::Test
143
143
 
144
144
  # subtyping of finite hashes and hashes; same pattern as tuples
145
145
  # subtyping of tuples and arrays
146
- tfs_1 = tt "{x: Fixnum, y: String}"
147
- thfs_1 = tt "Hash<Symbol, Fixnum or String>"
146
+ tfs_1 = tt "{x: Integer, y: String}"
147
+ thfs_1 = tt "Hash<Symbol, Integer or String>"
148
148
  assert (tfs_1 <= thfs_1) # subtyping allowed because tfs_1 promoted to hash
149
- tfs2_1 = tt "{x: Fixnum, y: String}"
149
+ tfs2_1 = tt "{x: Integer, y: String}"
150
150
  assert (not (tfs_1 <= tfs2_1)) # t12 has been promoted to hash, no longer subtype
151
151
 
152
- tfs_2 = tt "{x: Fixnum, y: String}"
153
- tfs2_2 = tt "{x: Fixnum, y: String}"
152
+ tfs_2 = tt "{x: Integer, y: String}"
153
+ tfs2_2 = tt "{x: Integer, y: String}"
154
154
  assert (tfs_2 <= tfs2_2) # this is allowed here because tfs_2 is still finite
155
- thfs_2 = tt "Hash<Symbol, Fixnum or String>"
155
+ thfs_2 = tt "Hash<Symbol, Integer or String>"
156
156
  assert (not (tfs_2 <= thfs_2)) # subtyping not allowed because tfs_2 <= tfs2_2 unsatisfiable after tfs_2 promoted
157
157
 
158
- tfs_3 = tt "{x: Fixnum, y: String}"
158
+ tfs_3 = tt "{x: Integer, y: String}"
159
159
  tfs2_3 = tt "{x: Object, y: Object}"
160
160
  assert (tfs_3 <= tfs2_3) # this is allowed here because t12a is still finite
161
161
  thfs_3 = tt "Hash<Symbol, Object>"
162
162
  assert (not (tfs2_3 <= thfs_3)) # subtyping not allowed because tfs_3 <= tfs2_3 unsatisfiable after tfs2_3 promoted
163
163
 
164
- tfs_4 = tt "{x: Fixnum, y: String}"
165
- tfs2_4 = tt "{x: Fixnum, y: String}"
164
+ tfs_4 = tt "{x: Integer, y: String}"
165
+ tfs2_4 = tt "{x: Integer, y: String}"
166
166
  assert (tfs_4 <= tfs2_4) # allowed, types are the same
167
- thfs_4 = tt "Hash<Symbol, Fixnum or String>"
167
+ thfs_4 = tt "Hash<Symbol, Integer or String>"
168
168
  assert (tfs2_4 <= thfs_4) # allowed, both tfs2_4 and tfs_4 promoted to hash
169
- tfs3_4 = tt "{x: Fixnum, y: String}"
169
+ tfs3_4 = tt "{x: Integer, y: String}"
170
170
  assert (not(tfs_4 <= tfs3_4)) # not allowed, tfs_4 has been promoted
171
171
 
172
- tfss_5 = tt "{x: Fixnum, y: String, **Symbol}"
173
- tfns_5 = tt "{x: Fixnum, **Symbol}"
174
- tfsn_5 = tt "{x: Fixnum, y: String}"
175
- tftn_5 = tt "{x: Fixnum, z: Symbol}"
172
+ tfss_5 = tt "{x: Integer, y: String, **Symbol}"
173
+ tfns_5 = tt "{x: Integer, **Symbol}"
174
+ tfsn_5 = tt "{x: Integer, y: String}"
175
+ tftn_5 = tt "{x: Integer, z: Symbol}"
176
176
  tooo_5 = tt "{x: Object, y: Object, **Object}"
177
177
  tono_5 = tt "{x: Object, **Object}"
178
178
  assert (tfss_5 <= tooo_5)
@@ -190,14 +190,14 @@ class TestLe < Minitest::Test
190
190
  assert (tftn_5 <= tfns_5)
191
191
  assert (not (tftn_5 <= tfsn_5))
192
192
 
193
- assert (not (tt("{x: ?Fixnum}") <= tt("{x: Fixnum}")))
193
+ assert (not (tt("{x: ?Integer}") <= tt("{x: Integer}")))
194
194
  end
195
195
 
196
196
  def test_method
197
- tss = MethodType.new([$__rdl_string_type], nil, $__rdl_string_type)
198
- tso = MethodType.new([$__rdl_string_type], nil, $__rdl_object_type)
199
- tos = MethodType.new([$__rdl_object_type], nil, $__rdl_string_type)
200
- too = MethodType.new([$__rdl_object_type], nil, $__rdl_object_type)
197
+ tss = MethodType.new([RDL::Globals.types[:string]], nil, RDL::Globals.types[:string])
198
+ tso = MethodType.new([RDL::Globals.types[:string]], nil, RDL::Globals.types[:object])
199
+ tos = MethodType.new([RDL::Globals.types[:object]], nil, RDL::Globals.types[:string])
200
+ too = MethodType.new([RDL::Globals.types[:object]], nil, RDL::Globals.types[:object])
201
201
  assert (tss <= tss)
202
202
  assert (tss <= tso)
203
203
  assert (not (tss <= tos))
@@ -214,21 +214,21 @@ class TestLe < Minitest::Test
214
214
  assert (too <= tso)
215
215
  assert (not (too <= tos))
216
216
  assert (too <= too)
217
- tbos = MethodType.new([], tos, $__rdl_object_type)
218
- tbso = MethodType.new([], tso, $__rdl_object_type)
217
+ tbos = MethodType.new([], tos, RDL::Globals.types[:object])
218
+ tbso = MethodType.new([], tso, RDL::Globals.types[:object])
219
219
  assert (tbos <= tbos)
220
220
  assert (not (tbos <= tbso))
221
221
  assert (tbso <= tbso)
222
222
  assert (tbso <= tbos)
223
- assert (tss <= $__rdl_proc_type)
223
+ assert (tss <= RDL::Globals.types[:proc])
224
224
  end
225
225
 
226
226
  def test_structural
227
- tso = MethodType.new([$__rdl_string_type], nil, $__rdl_object_type)
228
- tos = MethodType.new([$__rdl_object_type], nil, $__rdl_string_type)
227
+ tso = MethodType.new([RDL::Globals.types[:string]], nil, RDL::Globals.types[:object])
228
+ tos = MethodType.new([RDL::Globals.types[:object]], nil, RDL::Globals.types[:string])
229
229
  ts1 = StructuralType.new(m1: tso)
230
230
  ts2 = StructuralType.new(m1: tos)
231
- assert (ts1 <= $__rdl_top_type)
231
+ assert (ts1 <= RDL::Globals.types[:top])
232
232
  assert (ts1 <= ts1)
233
233
  assert (ts2 <= ts2)
234
234
  assert (ts2 <= ts1)
@@ -248,6 +248,7 @@ class TestLe < Minitest::Test
248
248
  end
249
249
 
250
250
  class NomT
251
+ extend RDL::Annotate
251
252
  type "() -> nil"
252
253
  def m1()
253
254
  nil
@@ -261,8 +262,8 @@ class TestLe < Minitest::Test
261
262
  def test_nominal_structural
262
263
  tnom = NominalType.new(Nom)
263
264
  tnomt = NominalType.new(NomT)
264
- tma = MethodType.new([], nil, $__rdl_nil_type)
265
- tmb = MethodType.new([$__rdl_fixnum_type], nil, $__rdl_nil_type)
265
+ tma = MethodType.new([], nil, RDL::Globals.types[:nil])
266
+ tmb = MethodType.new([RDL::Globals.types[:integer]], nil, RDL::Globals.types[:nil])
266
267
  ts1 = StructuralType.new(m1: tma)
267
268
  assert (tnom <= ts1)
268
269
  assert (tnomt <= ts1)
@@ -283,22 +284,22 @@ class TestLe < Minitest::Test
283
284
  assert_equal false, do_leq(tt("t"), @ta, false)[0]
284
285
  assert_equal false, do_leq(@ta, tt("t"), true)[0]
285
286
  assert_equal [true, {t: @ta}], do_leq(@ta, tt("t"), false)
286
- assert_equal [true, {}], do_leq($__rdl_bot_type, tt("t"), true)
287
- assert_equal [true, {}], do_leq($__rdl_bot_type, tt("t"), false)
288
- assert_equal false, do_leq($__rdl_top_type, tt("t"), true)[0]
289
- assert_equal [true, {t: $__rdl_top_type}], do_leq($__rdl_top_type, tt("t"), false)
287
+ assert_equal [true, {}], do_leq(RDL::Globals.types[:bot], tt("t"), true)
288
+ assert_equal [true, {}], do_leq(RDL::Globals.types[:bot], tt("t"), false)
289
+ assert_equal false, do_leq(RDL::Globals.types[:top], tt("t"), true)[0]
290
+ assert_equal [true, {t: RDL::Globals.types[:top]}], do_leq(RDL::Globals.types[:top], tt("t"), false)
290
291
  assert_equal [true, {t: @ta, u: @ta}], do_leq(tt("t or u"), @ta, true)
291
292
  assert_equal false, do_leq(tt("t or u"), @ta, false)[0]
292
293
  assert_equal false, do_leq(tt("3"), tt("t"), true)[0]
293
294
  assert_equal [true, {t: tt("3")}], do_leq(tt("3"), tt("t"), false)
294
- assert_equal [true, {t: $__rdl_fixnum_type}], do_leq(tt("Array<t>"), tt("Array<Fixnum>"), true)
295
- assert_equal false, do_leq(tt("Array<t>"), tt("Array<Fixnum>"), false)[0]
296
- assert_equal [true, {t: $__rdl_fixnum_type}], do_leq(tt("Array<Fixnum>"), tt("Array<t>"), false)
297
- assert_equal false, do_leq(tt("Array<Fixnum>"), tt("Array<t>"), true)[0]
298
- assert_equal [true, {t: $__rdl_fixnum_type, u: $__rdl_string_type}], do_leq(tt("Hash<t,u>"), tt("Hash<Fixnum,String>"), true)
299
- assert_equal [true, {t: $__rdl_fixnum_type}], do_leq(tt("Hash<t,t>"), tt("Hash<Fixnum,Fixnum>"), true)
300
- assert_equal false, do_leq(tt("Hash<t,t>"), tt("Hash<Fixnum,String>"), true)[0]
301
- assert_equal false, do_leq(tt("[m:()->t]"), tt("[m:()->Fixnum]"), true)[0] # no inst inside structural types
295
+ assert_equal [true, {t: RDL::Globals.types[:integer]}], do_leq(tt("Array<t>"), tt("Array<Integer>"), true)
296
+ assert_equal false, do_leq(tt("Array<t>"), tt("Array<Integer>"), false)[0]
297
+ assert_equal [true, {t: RDL::Globals.types[:integer]}], do_leq(tt("Array<Integer>"), tt("Array<t>"), false)
298
+ assert_equal false, do_leq(tt("Array<Integer>"), tt("Array<t>"), true)[0]
299
+ assert_equal [true, {t: RDL::Globals.types[:integer], u: RDL::Globals.types[:string]}], do_leq(tt("Hash<t,u>"), tt("Hash<Integer,String>"), true)
300
+ assert_equal [true, {t: RDL::Globals.types[:integer]}], do_leq(tt("Hash<t,t>"), tt("Hash<Integer,Integer>"), true)
301
+ assert_equal false, do_leq(tt("Hash<t,t>"), tt("Hash<Integer,String>"), true)[0]
302
+ assert_equal false, do_leq(tt("[m:()->t]"), tt("[m:()->Integer]"), true)[0] # no inst inside structural types
302
303
  end
303
304
 
304
305
  def do_leq(tleft, tright, ileft)
@@ -309,19 +310,19 @@ class TestLe < Minitest::Test
309
310
 
310
311
  # nonnull annotation is simply removed! so doesn't matter
311
312
  def test_leq_nonnull
312
- assert tt("!Fixnum") <= tt("!Fixnum")
313
- assert tt("!Fixnum") <= tt("Fixnum")
314
- assert tt("Fixnum") <= tt("!Fixnum")
315
- assert tt("!Fixnum") <= tt("!Object")
316
- assert tt("!Fixnum") <= tt("Object")
317
- assert tt("Fixnum") <= tt("!Object")
313
+ assert tt("!Integer") <= tt("!Integer")
314
+ assert tt("!Integer") <= tt("Integer")
315
+ assert tt("Integer") <= tt("!Integer")
316
+ assert tt("!Integer") <= tt("!Object")
317
+ assert tt("!Integer") <= tt("Object")
318
+ assert tt("Integer") <= tt("!Object")
318
319
  end
319
320
 
320
321
  # def test_intersection
321
322
  # skip "<= not defined on intersection"
322
- # tobject_and_basicobject = IntersectionType.new($__rdl_object_type, @tbasicobject)
323
- # assert (not (tobject_and_basicobject <= $__rdl_object_type))
324
- # assert ($__rdl_object_type <= tobject_and_basicobject)
323
+ # tobject_and_basicobject = IntersectionType.new(RDL::Globals.types[:object], @tbasicobject)
324
+ # assert (not (tobject_and_basicobject <= RDL::Globals.types[:object]))
325
+ # assert (RDL::Globals.types[:object] <= tobject_and_basicobject)
325
326
  # end
326
327
 
327
328
  end
@@ -17,16 +17,16 @@ class TestMember < Minitest::Test
17
17
  def setup
18
18
  @tbasicobject = NominalType.new "BasicObject"
19
19
  @tsymfoo = SingletonType.new :foo
20
- @tarraystring = GenericType.new($__rdl_array_type, $__rdl_string_type)
21
- @tarrayobject = GenericType.new($__rdl_array_type, $__rdl_object_type)
22
- @tarrayarraystring = GenericType.new($__rdl_array_type, @tarraystring)
23
- @tarrayarrayobject = GenericType.new($__rdl_array_type, @tarrayobject)
24
- $__rdl_hash_type = NominalType.new Hash
25
- @thashstringstring = GenericType.new($__rdl_hash_type, $__rdl_string_type, $__rdl_string_type)
26
- @thashobjectobject = GenericType.new($__rdl_hash_type, $__rdl_object_type, $__rdl_object_type)
27
- @tstring_or_sym = UnionType.new($__rdl_string_type, $__rdl_symbol_type)
28
- @tstring_and_sym = IntersectionType.new($__rdl_string_type, $__rdl_symbol_type)
29
- @tobject_and_basicobject = IntersectionType.new($__rdl_object_type, @tbasicobject)
20
+ @tarraystring = GenericType.new(RDL::Globals.types[:array], RDL::Globals.types[:string])
21
+ @tarrayobject = GenericType.new(RDL::Globals.types[:array], RDL::Globals.types[:object])
22
+ @tarrayarraystring = GenericType.new(RDL::Globals.types[:array], @tarraystring)
23
+ @tarrayarrayobject = GenericType.new(RDL::Globals.types[:array], @tarrayobject)
24
+ RDL::Globals.types[:hash] = NominalType.new Hash
25
+ @thashstringstring = GenericType.new(RDL::Globals.types[:hash], RDL::Globals.types[:string], RDL::Globals.types[:string])
26
+ @thashobjectobject = GenericType.new(RDL::Globals.types[:hash], RDL::Globals.types[:object], RDL::Globals.types[:object])
27
+ @tstring_or_sym = UnionType.new(RDL::Globals.types[:string], RDL::Globals.types[:symbol])
28
+ @tstring_and_sym = IntersectionType.new(RDL::Globals.types[:string], RDL::Globals.types[:symbol])
29
+ @tobject_and_basicobject = IntersectionType.new(RDL::Globals.types[:object], @tbasicobject)
30
30
  @ta = NominalType.new A
31
31
  @tb = NominalType.new B
32
32
  @tc = NominalType.new C
@@ -35,26 +35,26 @@ class TestMember < Minitest::Test
35
35
  end
36
36
 
37
37
  def test_nil
38
- assert ($__rdl_nil_type.member? nil)
39
- assert (not ($__rdl_nil_type.member? "foo"))
40
- assert (not ($__rdl_nil_type.member? (Object.new)))
38
+ assert (RDL::Globals.types[:nil].member? nil)
39
+ assert (not (RDL::Globals.types[:nil].member? "foo"))
40
+ assert (not (RDL::Globals.types[:nil].member? (Object.new)))
41
41
  end
42
42
 
43
43
  def test_top
44
- assert ($__rdl_top_type.member? nil)
45
- assert ($__rdl_top_type.member? "foo")
46
- assert ($__rdl_top_type.member? (Object.new))
44
+ assert (RDL::Globals.types[:top].member? nil)
45
+ assert (RDL::Globals.types[:top].member? "foo")
46
+ assert (RDL::Globals.types[:top].member? (Object.new))
47
47
  end
48
48
 
49
49
  def test_nominal
50
50
  o = Object.new
51
- assert ($__rdl_string_type.member? "Foo")
52
- assert (not ($__rdl_string_type.member? :Foo))
53
- assert (not ($__rdl_string_type.member? o))
51
+ assert (RDL::Globals.types[:string].member? "Foo")
52
+ assert (not (RDL::Globals.types[:string].member? :Foo))
53
+ assert (not (RDL::Globals.types[:string].member? o))
54
54
 
55
- assert ($__rdl_object_type.member? "Foo")
56
- assert ($__rdl_object_type.member? :Foo)
57
- assert ($__rdl_object_type.member? o)
55
+ assert (RDL::Globals.types[:object].member? "Foo")
56
+ assert (RDL::Globals.types[:object].member? :Foo)
57
+ assert (RDL::Globals.types[:object].member? o)
58
58
 
59
59
  assert (@tkernel.member? "Foo")
60
60
  assert (@tkernel.member? :Foo)
@@ -73,14 +73,14 @@ class TestMember < Minitest::Test
73
73
  assert (not (@tc.member? b))
74
74
  assert (@tc.member? c)
75
75
 
76
- assert ($__rdl_string_type.member? nil)
77
- assert ($__rdl_object_type.member? nil)
76
+ assert (RDL::Globals.types[:string].member? nil)
77
+ assert (RDL::Globals.types[:object].member? nil)
78
78
  end
79
79
 
80
80
  def test_symbol
81
- assert ($__rdl_symbol_type.member? :foo)
82
- assert ($__rdl_symbol_type.member? :bar)
83
- assert (not ($__rdl_symbol_type.member? "foo"))
81
+ assert (RDL::Globals.types[:symbol].member? :foo)
82
+ assert (RDL::Globals.types[:symbol].member? :bar)
83
+ assert (not (RDL::Globals.types[:symbol].member? "foo"))
84
84
  assert (@tsymfoo.member? :foo)
85
85
  assert (not (@tsymfoo.member? :bar))
86
86
  assert (not (@tsymfoo.member? "foo"))
@@ -109,7 +109,7 @@ class TestMember < Minitest::Test
109
109
  end
110
110
 
111
111
  def test_tuple
112
- t1 = TupleType.new($__rdl_symbol_type, $__rdl_string_type)
112
+ t1 = TupleType.new(RDL::Globals.types[:symbol], RDL::Globals.types[:string])
113
113
  assert (t1.member? [:foo, "foo"])
114
114
  assert (not (t1.member? ["foo", :foo]))
115
115
  assert (not (t1.member? [:foo, "foo", "bar"]))
@@ -119,19 +119,19 @@ class TestMember < Minitest::Test
119
119
  end
120
120
 
121
121
  def test_finite_hash
122
- t1 = FiniteHashType.new({a: $__rdl_symbol_type, b: $__rdl_string_type}, nil)
122
+ t1 = FiniteHashType.new({a: RDL::Globals.types[:symbol], b: RDL::Globals.types[:string]}, nil)
123
123
  assert (t1.member?(a: :foo, b: "foo"))
124
124
  assert (not (t1.member?(a: 1, b: "foo")))
125
125
  assert (not (t1.member?(a: :foo)))
126
126
  assert (not (t1.member?(b: "foo")))
127
127
  assert (not (t1.member?(a: :foo, b: "foo", c: :baz)))
128
- t2 = FiniteHashType.new({"a"=>$__rdl_symbol_type, 2=>$__rdl_string_type}, nil)
128
+ t2 = FiniteHashType.new({"a"=>RDL::Globals.types[:symbol], 2=>RDL::Globals.types[:string]}, nil)
129
129
  assert (t2.member?({"a"=>:foo, 2=>"foo"}))
130
130
  assert (not (t2.member?({"a"=>2, 2=>"foo"})))
131
131
  assert (not (t2.member?({"a"=>:foo})))
132
132
  assert (not (t2.member?({2=>"foo"})))
133
133
  assert (not (t2.member?({"a"=>:foo, 2=>"foo", 3=>"bar"})))
134
- t3 = FiniteHashType.new({"a"=>$__rdl_symbol_type, 2=>$__rdl_string_type}, $__rdl_fixnum_type)
134
+ t3 = FiniteHashType.new({"a"=>RDL::Globals.types[:symbol], 2=>RDL::Globals.types[:string]}, RDL::Globals.types[:integer])
135
135
  assert (t3.member?({"a"=>:foo, 2=>"foo"}))
136
136
  assert (t3.member?({"a"=>:foo, 2=>"foo", two: 2}))
137
137
  assert (t3.member?({"a"=>:foo, 2=>"foo", two: 2, three: 3}))
@@ -139,12 +139,12 @@ class TestMember < Minitest::Test
139
139
  assert (not (t3.member?({"a"=>:foo, 2=>"foo", two: 2, three: 'three'})))
140
140
  assert (not (t3.member?({"a"=>:foo, two: 2})))
141
141
  assert (not (t3.member?({2=>"foo", two: 2})))
142
- t4 = FiniteHashType.new({a: $__rdl_symbol_type, b: $__rdl_string_type}, $__rdl_fixnum_type)
142
+ t4 = FiniteHashType.new({a: RDL::Globals.types[:symbol], b: RDL::Globals.types[:string]}, RDL::Globals.types[:integer])
143
143
  assert (t4.member?(a: :foo, b: "foo"))
144
144
  assert (t4.member?(a: :foo, b: "foo", c: 3))
145
145
  assert (t4.member?(a: :foo, b: "foo", c: 3, d: 4))
146
146
  assert (not (t4.member?(a: :foo, b: "foo", c: "three")))
147
- t5 = FiniteHashType.new({a: $__rdl_symbol_type, b: OptionalType.new($__rdl_string_type)}, $__rdl_fixnum_type)
147
+ t5 = FiniteHashType.new({a: RDL::Globals.types[:symbol], b: OptionalType.new(RDL::Globals.types[:string])}, RDL::Globals.types[:integer])
148
148
  assert (t5.member?(a: :foo, b: "foo"))
149
149
  assert (t5.member?(a: :foo, b: "foo", c: 3))
150
150
  assert (t5.member?(a: :foo, b: "foo", c: 3, d: 4))