laser 0.7.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (319) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +14 -0
  4. data/LICENSE +661 -0
  5. data/README.md +158 -0
  6. data/Rakefile +104 -0
  7. data/VERSION +1 -0
  8. data/bin/laser +7 -0
  9. data/design_docs/goals.md +57 -0
  10. data/design_docs/object_regex.md +426 -0
  11. data/design_docs/type_annotations.md +80 -0
  12. data/ext/laser/BasicBlock.cpp +572 -0
  13. data/ext/laser/BasicBlock.h +118 -0
  14. data/ext/laser/extconf.rb +3 -0
  15. data/features/laser.feature +25 -0
  16. data/features/step_definitions/laser_steps.rb +39 -0
  17. data/features/support/env.rb +14 -0
  18. data/features/support/testdata/1_input +1 -0
  19. data/features/support/testdata/1_output +1 -0
  20. data/features/support/testdata/2_input +4 -0
  21. data/features/support/testdata/2_output +4 -0
  22. data/features/support/testdata/3_input +8 -0
  23. data/features/support/testdata/3_output +11 -0
  24. data/features/support/testdata/4_input +5 -0
  25. data/features/support/testdata/4_output +5 -0
  26. data/features/support/testdata/5_input +13 -0
  27. data/laser.gemspec +382 -0
  28. data/lib/laser.rb +98 -0
  29. data/lib/laser/analysis/annotations.rb +95 -0
  30. data/lib/laser/analysis/annotations/annotation_config.yaml +3 -0
  31. data/lib/laser/analysis/annotations/comment_attachment_annotation.rb +66 -0
  32. data/lib/laser/analysis/annotations/node_pointers_annotation.rb +36 -0
  33. data/lib/laser/analysis/annotations/runtime_annotation.rb +55 -0
  34. data/lib/laser/analysis/argument_expansion.rb +132 -0
  35. data/lib/laser/analysis/arity.rb +34 -0
  36. data/lib/laser/analysis/bindings.rb +144 -0
  37. data/lib/laser/analysis/bootstrap/bootstrap.rb +298 -0
  38. data/lib/laser/analysis/bootstrap/laser_class.rb +106 -0
  39. data/lib/laser/analysis/bootstrap/laser_method.rb +255 -0
  40. data/lib/laser/analysis/bootstrap/laser_module.rb +403 -0
  41. data/lib/laser/analysis/bootstrap/laser_module_copy.rb +74 -0
  42. data/lib/laser/analysis/bootstrap/laser_object.rb +69 -0
  43. data/lib/laser/analysis/bootstrap/laser_proc.rb +150 -0
  44. data/lib/laser/analysis/bootstrap/laser_singleton_class.rb +44 -0
  45. data/lib/laser/analysis/comments.rb +35 -0
  46. data/lib/laser/analysis/control_flow.rb +28 -0
  47. data/lib/laser/analysis/control_flow/alias_analysis.rb +31 -0
  48. data/lib/laser/analysis/control_flow/basic_block.rb +105 -0
  49. data/lib/laser/analysis/control_flow/cfg_builder.rb +2505 -0
  50. data/lib/laser/analysis/control_flow/cfg_instruction.rb +190 -0
  51. data/lib/laser/analysis/control_flow/constant_propagation.rb +742 -0
  52. data/lib/laser/analysis/control_flow/control_flow_graph.rb +370 -0
  53. data/lib/laser/analysis/control_flow/lifetime_analysis.rb +91 -0
  54. data/lib/laser/analysis/control_flow/method_call_search.rb +26 -0
  55. data/lib/laser/analysis/control_flow/raise_properties.rb +25 -0
  56. data/lib/laser/analysis/control_flow/simulation.rb +385 -0
  57. data/lib/laser/analysis/control_flow/static_single_assignment.rb +185 -0
  58. data/lib/laser/analysis/control_flow/unreachability_analysis.rb +57 -0
  59. data/lib/laser/analysis/control_flow/unused_variables.rb +91 -0
  60. data/lib/laser/analysis/control_flow/yield_properties.rb +103 -0
  61. data/lib/laser/analysis/errors.rb +131 -0
  62. data/lib/laser/analysis/laser_utils.rb +18 -0
  63. data/lib/laser/analysis/lexical_analysis.rb +172 -0
  64. data/lib/laser/analysis/method_call.rb +68 -0
  65. data/lib/laser/analysis/protocol_registry.rb +30 -0
  66. data/lib/laser/analysis/scope.rb +118 -0
  67. data/lib/laser/analysis/sexp.rb +159 -0
  68. data/lib/laser/analysis/sexp_analysis.rb +40 -0
  69. data/lib/laser/analysis/sexp_extensions/constant_extraction.rb +115 -0
  70. data/lib/laser/analysis/sexp_extensions/source_location.rb +164 -0
  71. data/lib/laser/analysis/sexp_extensions/type_inference.rb +47 -0
  72. data/lib/laser/analysis/signature.rb +76 -0
  73. data/lib/laser/analysis/special_methods/send.rb +67 -0
  74. data/lib/laser/analysis/unused_methods.rb +21 -0
  75. data/lib/laser/analysis/visitor.rb +141 -0
  76. data/lib/laser/annotation_parser/annotations.treetop +126 -0
  77. data/lib/laser/annotation_parser/annotations_parser.rb +748 -0
  78. data/lib/laser/annotation_parser/class_annotations.treetop +82 -0
  79. data/lib/laser/annotation_parser/class_annotations_parser.rb +654 -0
  80. data/lib/laser/annotation_parser/overload.treetop +24 -0
  81. data/lib/laser/annotation_parser/overload_parser.rb +167 -0
  82. data/lib/laser/annotation_parser/parsers.rb +6 -0
  83. data/lib/laser/annotation_parser/structural.treetop +37 -0
  84. data/lib/laser/annotation_parser/structural_parser.rb +406 -0
  85. data/lib/laser/annotation_parser/useful_parsers.treetop +47 -0
  86. data/lib/laser/annotation_parser/useful_parsers_parser.rb +674 -0
  87. data/lib/laser/rake/task.rb +46 -0
  88. data/lib/laser/runner.rb +189 -0
  89. data/lib/laser/scanner.rb +169 -0
  90. data/lib/laser/standard_library/_thread.rb +110 -0
  91. data/lib/laser/standard_library/abbrev.rb +103 -0
  92. data/lib/laser/standard_library/array.rb +418 -0
  93. data/lib/laser/standard_library/base64.rb +91 -0
  94. data/lib/laser/standard_library/basic_object.rb +55 -0
  95. data/lib/laser/standard_library/benchmark.rb +556 -0
  96. data/lib/laser/standard_library/bignum.rb +185 -0
  97. data/lib/laser/standard_library/cgi.rb +275 -0
  98. data/lib/laser/standard_library/cgi/cookie.rb +147 -0
  99. data/lib/laser/standard_library/cgi/core.rb +791 -0
  100. data/lib/laser/standard_library/cgi/html.rb +1021 -0
  101. data/lib/laser/standard_library/cgi/session.rb +537 -0
  102. data/lib/laser/standard_library/cgi/session/pstore.rb +111 -0
  103. data/lib/laser/standard_library/cgi/util.rb +188 -0
  104. data/lib/laser/standard_library/class_definitions.rb +333 -0
  105. data/lib/laser/standard_library/comparable.rb +125 -0
  106. data/lib/laser/standard_library/complex.rb +162 -0
  107. data/lib/laser/standard_library/enumerable.rb +178 -0
  108. data/lib/laser/standard_library/exceptions.rb +135 -0
  109. data/lib/laser/standard_library/fixnum.rb +188 -0
  110. data/lib/laser/standard_library/float.rb +180 -0
  111. data/lib/laser/standard_library/hash.rb +237 -0
  112. data/lib/laser/standard_library/integer.rb +123 -0
  113. data/lib/laser/standard_library/laser_magic.rb +7 -0
  114. data/lib/laser/standard_library/nil_false_true.rb +113 -0
  115. data/lib/laser/standard_library/numbers.rb +192 -0
  116. data/lib/laser/standard_library/proc.rb +31 -0
  117. data/lib/laser/standard_library/set.rb +1348 -0
  118. data/lib/laser/standard_library/string.rb +666 -0
  119. data/lib/laser/standard_library/stringio.rb +2 -0
  120. data/lib/laser/standard_library/symbol.rb +125 -0
  121. data/lib/laser/standard_library/tsort.rb +242 -0
  122. data/lib/laser/support/acts_as_struct.rb +66 -0
  123. data/lib/laser/support/frequency.rb +55 -0
  124. data/lib/laser/support/inheritable_attributes.rb +145 -0
  125. data/lib/laser/support/module_extensions.rb +94 -0
  126. data/lib/laser/support/placeholder_object.rb +13 -0
  127. data/lib/laser/third_party/rgl/adjacency.rb +221 -0
  128. data/lib/laser/third_party/rgl/base.rb +228 -0
  129. data/lib/laser/third_party/rgl/bidirectional.rb +39 -0
  130. data/lib/laser/third_party/rgl/condensation.rb +47 -0
  131. data/lib/laser/third_party/rgl/connected_components.rb +138 -0
  132. data/lib/laser/third_party/rgl/control_flow.rb +170 -0
  133. data/lib/laser/third_party/rgl/depth_first_spanning_tree.rb +37 -0
  134. data/lib/laser/third_party/rgl/dominators.rb +124 -0
  135. data/lib/laser/third_party/rgl/dot.rb +93 -0
  136. data/lib/laser/third_party/rgl/graphxml.rb +51 -0
  137. data/lib/laser/third_party/rgl/implicit.rb +174 -0
  138. data/lib/laser/third_party/rgl/mutable.rb +117 -0
  139. data/lib/laser/third_party/rgl/rdot.rb +445 -0
  140. data/lib/laser/third_party/rgl/topsort.rb +72 -0
  141. data/lib/laser/third_party/rgl/transitivity.rb +180 -0
  142. data/lib/laser/third_party/rgl/traversal.rb +348 -0
  143. data/lib/laser/types/types.rb +433 -0
  144. data/lib/laser/version.rb +14 -0
  145. data/lib/laser/warning.rb +149 -0
  146. data/lib/laser/warning_sets/default.yml +13 -0
  147. data/lib/laser/warnings/assignment_in_condition.rb +20 -0
  148. data/lib/laser/warnings/comment_spacing.rb +31 -0
  149. data/lib/laser/warnings/extra_blank_lines.rb +30 -0
  150. data/lib/laser/warnings/extra_whitespace.rb +16 -0
  151. data/lib/laser/warnings/hash_symbol_18_warning.rb +63 -0
  152. data/lib/laser/warnings/hash_symbol_19_warning.rb +29 -0
  153. data/lib/laser/warnings/line_length.rb +115 -0
  154. data/lib/laser/warnings/misaligned_unindentation.rb +17 -0
  155. data/lib/laser/warnings/operator_spacing.rb +68 -0
  156. data/lib/laser/warnings/parens_on_declaration.rb +30 -0
  157. data/lib/laser/warnings/rescue_exception.rb +42 -0
  158. data/lib/laser/warnings/semicolon.rb +25 -0
  159. data/lib/laser/warnings/sexp_errors.rb +24 -0
  160. data/lib/laser/warnings/uncalled_method_warning.rb +7 -0
  161. data/lib/laser/warnings/useless_double_quotes.rb +38 -0
  162. data/spec/analysis_specs/annotations_spec.rb +47 -0
  163. data/spec/analysis_specs/annotations_specs/comment_attachment_spec.rb +68 -0
  164. data/spec/analysis_specs/annotations_specs/node_pointers_annotation_spec.rb +90 -0
  165. data/spec/analysis_specs/annotations_specs/runtime_annotation_spec.rb +135 -0
  166. data/spec/analysis_specs/annotations_specs/spec_helper.rb +33 -0
  167. data/spec/analysis_specs/argument_expansion_spec.rb +113 -0
  168. data/spec/analysis_specs/bindings_spec.rb +36 -0
  169. data/spec/analysis_specs/comment_spec.rb +93 -0
  170. data/spec/analysis_specs/control_flow_specs/cfg_instruction_spec.rb +111 -0
  171. data/spec/analysis_specs/control_flow_specs/constant_propagation_spec.rb +560 -0
  172. data/spec/analysis_specs/control_flow_specs/control_flow_graph_spec.rb +5 -0
  173. data/spec/analysis_specs/control_flow_specs/raise_properties_spec.rb +310 -0
  174. data/spec/analysis_specs/control_flow_specs/raise_type_inference_spec.rb +301 -0
  175. data/spec/analysis_specs/control_flow_specs/return_type_inference_spec.rb +431 -0
  176. data/spec/analysis_specs/control_flow_specs/simulation_spec.rb +158 -0
  177. data/spec/analysis_specs/control_flow_specs/spec_helper.rb +110 -0
  178. data/spec/analysis_specs/control_flow_specs/tuple_misuse_inference_spec.rb +125 -0
  179. data/spec/analysis_specs/control_flow_specs/unreachability_analysis_spec.rb +76 -0
  180. data/spec/analysis_specs/control_flow_specs/unused_variable_spec.rb +99 -0
  181. data/spec/analysis_specs/control_flow_specs/yield_properties_spec.rb +372 -0
  182. data/spec/analysis_specs/error_spec.rb +30 -0
  183. data/spec/analysis_specs/laser_class_spec.rb +322 -0
  184. data/spec/analysis_specs/lexical_analysis_spec.rb +184 -0
  185. data/spec/analysis_specs/protocol_registry_spec.rb +63 -0
  186. data/spec/analysis_specs/scope_annotation_spec.rb +1013 -0
  187. data/spec/analysis_specs/scope_spec.rb +126 -0
  188. data/spec/analysis_specs/sexp_analysis_spec.rb +30 -0
  189. data/spec/analysis_specs/sexp_extension_specs/constant_extraction_spec.rb +309 -0
  190. data/spec/analysis_specs/sexp_extension_specs/source_location_spec.rb +231 -0
  191. data/spec/analysis_specs/sexp_extension_specs/spec_helper.rb +1 -0
  192. data/spec/analysis_specs/sexp_extension_specs/type_inference_spec.rb +252 -0
  193. data/spec/analysis_specs/sexp_spec.rb +167 -0
  194. data/spec/analysis_specs/spec_helper.rb +27 -0
  195. data/spec/analysis_specs/unused_methods_spec.rb +65 -0
  196. data/spec/analysis_specs/visitor_spec.rb +64 -0
  197. data/spec/annotation_parser_specs/annotations_parser_spec.rb +89 -0
  198. data/spec/annotation_parser_specs/class_annotation_parser_spec.rb +120 -0
  199. data/spec/annotation_parser_specs/overload_parser_spec.rb +39 -0
  200. data/spec/annotation_parser_specs/parsers_spec.rb +14 -0
  201. data/spec/annotation_parser_specs/spec_helper.rb +1 -0
  202. data/spec/annotation_parser_specs/structural_parser_spec.rb +67 -0
  203. data/spec/laser_spec.rb +14 -0
  204. data/spec/rake_specs/spec_helper.rb +1 -0
  205. data/spec/rake_specs/task_spec.rb +67 -0
  206. data/spec/runner_spec.rb +207 -0
  207. data/spec/scanner_spec.rb +75 -0
  208. data/spec/spec_helper.rb +121 -0
  209. data/spec/standard_library/exceptions_spec.rb +19 -0
  210. data/spec/standard_library/globals_spec.rb +14 -0
  211. data/spec/standard_library/set_spec.rb +31 -0
  212. data/spec/standard_library/spec_helper.rb +1 -0
  213. data/spec/standard_library/standard_library_spec.rb +302 -0
  214. data/spec/support_specs/acts_as_struct_spec.rb +94 -0
  215. data/spec/support_specs/frequency_spec.rb +23 -0
  216. data/spec/support_specs/module_extensions_spec.rb +117 -0
  217. data/spec/support_specs/spec_helper.rb +1 -0
  218. data/spec/type_specs/spec_helper.rb +1 -0
  219. data/spec/type_specs/types_spec.rb +133 -0
  220. data/spec/warning_spec.rb +95 -0
  221. data/spec/warning_specs/assignment_in_condition_spec.rb +68 -0
  222. data/spec/warning_specs/comment_spacing_spec.rb +65 -0
  223. data/spec/warning_specs/extra_blank_lines_spec.rb +70 -0
  224. data/spec/warning_specs/extra_whitespace_spec.rb +33 -0
  225. data/spec/warning_specs/hash_symbol_18_warning_spec.rb +89 -0
  226. data/spec/warning_specs/hash_symbol_19_warning_spec.rb +63 -0
  227. data/spec/warning_specs/line_length_spec.rb +173 -0
  228. data/spec/warning_specs/misaligned_unindentation_spec.rb +35 -0
  229. data/spec/warning_specs/operator_spacing_spec.rb +104 -0
  230. data/spec/warning_specs/parens_on_declaration_spec.rb +57 -0
  231. data/spec/warning_specs/rescue_exception_spec.rb +105 -0
  232. data/spec/warning_specs/semicolon_spec.rb +58 -0
  233. data/spec/warning_specs/spec_helper.rb +1 -0
  234. data/spec/warning_specs/useless_double_quotes_spec.rb +74 -0
  235. data/status_reports/2010/12/2010-12-14.md +163 -0
  236. data/status_reports/2010/12/2010-12-23.md +298 -0
  237. data/status_reports/2010/12/2010-12-24.md +6 -0
  238. data/test/third_party_tests/rgl_tests/TestComponents.rb +65 -0
  239. data/test/third_party_tests/rgl_tests/TestCycles.rb +61 -0
  240. data/test/third_party_tests/rgl_tests/TestDirectedGraph.rb +125 -0
  241. data/test/third_party_tests/rgl_tests/TestDot.rb +18 -0
  242. data/test/third_party_tests/rgl_tests/TestEdge.rb +34 -0
  243. data/test/third_party_tests/rgl_tests/TestGraph.rb +71 -0
  244. data/test/third_party_tests/rgl_tests/TestGraphXML.rb +57 -0
  245. data/test/third_party_tests/rgl_tests/TestImplicit.rb +52 -0
  246. data/test/third_party_tests/rgl_tests/TestRdot.rb +863 -0
  247. data/test/third_party_tests/rgl_tests/TestTransitivity.rb +129 -0
  248. data/test/third_party_tests/rgl_tests/TestTraversal.rb +220 -0
  249. data/test/third_party_tests/rgl_tests/TestUnDirectedGraph.rb +102 -0
  250. data/test/third_party_tests/rgl_tests/examples/north/Graph.log +128 -0
  251. data/test/third_party_tests/rgl_tests/examples/north/g.10.0.graphml +28 -0
  252. data/test/third_party_tests/rgl_tests/examples/north/g.10.1.graphml +28 -0
  253. data/test/third_party_tests/rgl_tests/examples/north/g.10.11.graphml +31 -0
  254. data/test/third_party_tests/rgl_tests/examples/north/g.10.12.graphml +27 -0
  255. data/test/third_party_tests/rgl_tests/examples/north/g.10.13.graphml +27 -0
  256. data/test/third_party_tests/rgl_tests/examples/north/g.10.14.graphml +27 -0
  257. data/test/third_party_tests/rgl_tests/examples/north/g.10.15.graphml +26 -0
  258. data/test/third_party_tests/rgl_tests/examples/north/g.10.16.graphml +26 -0
  259. data/test/third_party_tests/rgl_tests/examples/north/g.10.17.graphml +26 -0
  260. data/test/third_party_tests/rgl_tests/examples/north/g.10.19.graphml +37 -0
  261. data/test/third_party_tests/rgl_tests/examples/north/g.10.2.graphml +28 -0
  262. data/test/third_party_tests/rgl_tests/examples/north/g.10.20.graphml +38 -0
  263. data/test/third_party_tests/rgl_tests/examples/north/g.10.22.graphml +43 -0
  264. data/test/third_party_tests/rgl_tests/examples/north/g.10.24.graphml +30 -0
  265. data/test/third_party_tests/rgl_tests/examples/north/g.10.25.graphml +45 -0
  266. data/test/third_party_tests/rgl_tests/examples/north/g.10.27.graphml +38 -0
  267. data/test/third_party_tests/rgl_tests/examples/north/g.10.28.graphml +30 -0
  268. data/test/third_party_tests/rgl_tests/examples/north/g.10.29.graphml +38 -0
  269. data/test/third_party_tests/rgl_tests/examples/north/g.10.3.graphml +26 -0
  270. data/test/third_party_tests/rgl_tests/examples/north/g.10.30.graphml +34 -0
  271. data/test/third_party_tests/rgl_tests/examples/north/g.10.31.graphml +42 -0
  272. data/test/third_party_tests/rgl_tests/examples/north/g.10.34.graphml +42 -0
  273. data/test/third_party_tests/rgl_tests/examples/north/g.10.37.graphml +28 -0
  274. data/test/third_party_tests/rgl_tests/examples/north/g.10.38.graphml +38 -0
  275. data/test/third_party_tests/rgl_tests/examples/north/g.10.39.graphml +36 -0
  276. data/test/third_party_tests/rgl_tests/examples/north/g.10.4.graphml +26 -0
  277. data/test/third_party_tests/rgl_tests/examples/north/g.10.40.graphml +37 -0
  278. data/test/third_party_tests/rgl_tests/examples/north/g.10.41.graphml +37 -0
  279. data/test/third_party_tests/rgl_tests/examples/north/g.10.42.graphml +26 -0
  280. data/test/third_party_tests/rgl_tests/examples/north/g.10.45.graphml +28 -0
  281. data/test/third_party_tests/rgl_tests/examples/north/g.10.46.graphml +32 -0
  282. data/test/third_party_tests/rgl_tests/examples/north/g.10.5.graphml +31 -0
  283. data/test/third_party_tests/rgl_tests/examples/north/g.10.50.graphml +30 -0
  284. data/test/third_party_tests/rgl_tests/examples/north/g.10.56.graphml +29 -0
  285. data/test/third_party_tests/rgl_tests/examples/north/g.10.57.graphml +32 -0
  286. data/test/third_party_tests/rgl_tests/examples/north/g.10.58.graphml +32 -0
  287. data/test/third_party_tests/rgl_tests/examples/north/g.10.6.graphml +26 -0
  288. data/test/third_party_tests/rgl_tests/examples/north/g.10.60.graphml +32 -0
  289. data/test/third_party_tests/rgl_tests/examples/north/g.10.61.graphml +34 -0
  290. data/test/third_party_tests/rgl_tests/examples/north/g.10.62.graphml +34 -0
  291. data/test/third_party_tests/rgl_tests/examples/north/g.10.68.graphml +30 -0
  292. data/test/third_party_tests/rgl_tests/examples/north/g.10.69.graphml +32 -0
  293. data/test/third_party_tests/rgl_tests/examples/north/g.10.7.graphml +29 -0
  294. data/test/third_party_tests/rgl_tests/examples/north/g.10.70.graphml +26 -0
  295. data/test/third_party_tests/rgl_tests/examples/north/g.10.71.graphml +27 -0
  296. data/test/third_party_tests/rgl_tests/examples/north/g.10.72.graphml +28 -0
  297. data/test/third_party_tests/rgl_tests/examples/north/g.10.74.graphml +29 -0
  298. data/test/third_party_tests/rgl_tests/examples/north/g.10.75.graphml +29 -0
  299. data/test/third_party_tests/rgl_tests/examples/north/g.10.78.graphml +27 -0
  300. data/test/third_party_tests/rgl_tests/examples/north/g.10.79.graphml +34 -0
  301. data/test/third_party_tests/rgl_tests/examples/north/g.10.8.graphml +29 -0
  302. data/test/third_party_tests/rgl_tests/examples/north/g.10.80.graphml +34 -0
  303. data/test/third_party_tests/rgl_tests/examples/north/g.10.82.graphml +35 -0
  304. data/test/third_party_tests/rgl_tests/examples/north/g.10.83.graphml +32 -0
  305. data/test/third_party_tests/rgl_tests/examples/north/g.10.85.graphml +34 -0
  306. data/test/third_party_tests/rgl_tests/examples/north/g.10.86.graphml +34 -0
  307. data/test/third_party_tests/rgl_tests/examples/north/g.10.88.graphml +37 -0
  308. data/test/third_party_tests/rgl_tests/examples/north/g.10.89.graphml +29 -0
  309. data/test/third_party_tests/rgl_tests/examples/north/g.10.9.graphml +26 -0
  310. data/test/third_party_tests/rgl_tests/examples/north/g.10.90.graphml +32 -0
  311. data/test/third_party_tests/rgl_tests/examples/north/g.10.91.graphml +31 -0
  312. data/test/third_party_tests/rgl_tests/examples/north/g.10.92.graphml +26 -0
  313. data/test/third_party_tests/rgl_tests/examples/north/g.10.93.graphml +32 -0
  314. data/test/third_party_tests/rgl_tests/examples/north/g.10.94.graphml +34 -0
  315. data/test/third_party_tests/rgl_tests/examples/north/g.12.8.graphml +40 -0
  316. data/test/third_party_tests/rgl_tests/examples/north/g.14.9.graphml +36 -0
  317. data/test/third_party_tests/rgl_tests/test_helper.rb +7 -0
  318. data/test/third_party_tests/test_inheritable_attributes.rb +187 -0
  319. metadata +470 -0
@@ -0,0 +1,5 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe ControlFlow::ControlFlowGraph do
4
+
5
+ end
@@ -0,0 +1,310 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe ControlFlow::RaiseProperties do
4
+ it 'should recognize simple methods that raise no exceptions due to constants' do
5
+ g = cfg_method <<-EOF
6
+ def foo(x)
7
+ y = 'hello' * 2
8
+ p(y)
9
+ y.singleton_class
10
+ end
11
+ EOF
12
+ g.raise_frequency.should be Frequency::NEVER
13
+ end
14
+
15
+ it 'should recognize simple methods that unconditionally raise' do
16
+ g = cfg_method <<-EOF
17
+ def foo(x)
18
+ raise SomeError.new(x)
19
+ end
20
+ EOF
21
+ g.raise_frequency.should be Frequency::ALWAYS
22
+ end
23
+
24
+ it 'should recognize raiseability via aliases' do
25
+ g = cfg_method <<-EOF
26
+ def foo(x)
27
+ fail SomeError.new(x)
28
+ end
29
+ EOF
30
+ g.raise_frequency.should be Frequency::ALWAYS
31
+ end
32
+
33
+ it 'should recognize simple methods that might raise' do
34
+ g = cfg_method <<-EOF
35
+ def foo(x)
36
+ if gets # may raise
37
+ 'hi'
38
+ else
39
+ 'there'
40
+ end
41
+ end
42
+ EOF
43
+ g.raise_frequency.should be Frequency::MAYBE
44
+ end
45
+
46
+ it 'should recognize when private methods are called' do
47
+ g = cfg_method <<-EOF
48
+ def foo(x)
49
+ String.alias_method(:bar, :<<)
50
+ end
51
+ EOF
52
+ g.raise_frequency.should be Frequency::ALWAYS
53
+ end
54
+
55
+ it 'should use types to improve raising inference on user code' do
56
+ g = cfg <<-EOF
57
+ module RInfer1
58
+ def self.multiply(x)
59
+ check_and_mult(x)
60
+ end
61
+
62
+ def self.check_and_mult(y)
63
+ if String === y
64
+ raise 'no strings!'
65
+ end
66
+ p(y)
67
+ end
68
+ end
69
+ EOF
70
+ method = ClassRegistry['RInfer1'].singleton_class.instance_method(:multiply)
71
+ method.raise_frequency_for_types(
72
+ Utilities.type_for(ClassRegistry['RInfer1']),
73
+ [Types::FIXNUM],
74
+ Types::NILCLASS).should == Frequency::NEVER
75
+ method.raise_frequency_for_types(
76
+ Utilities.type_for(ClassRegistry['RInfer1']),
77
+ [Types::STRING],
78
+ Types::NILCLASS).should == Frequency::ALWAYS
79
+ end
80
+
81
+ it 'should infer raises from #initialize when calling Class.new' do
82
+ g = cfg <<-EOF
83
+ class RInfer2
84
+ def initialize(x)
85
+ raise TypeError.new("I don't like integers") if Integer === x
86
+ end
87
+ end
88
+ def make_rinfer_2(x)
89
+ RInfer2.new(x)
90
+ end
91
+ EOF
92
+ method = ClassRegistry['Object'].instance_method(:make_rinfer_2)
93
+ # call make_rinfer_2 should raise for a fixnum
94
+ method.raise_frequency_for_types(
95
+ Types::STRING, # doesn't matter
96
+ [Types::FIXNUM],
97
+ Types::NILCLASS).should == Frequency::ALWAYS
98
+ method.raise_frequency_for_types(
99
+ Types::STRING, # doesn't matter
100
+ [ClassRegistry['Bignum'].as_type],
101
+ Types::NILCLASS).should == Frequency::ALWAYS
102
+ method.raise_frequency_for_types(
103
+ Types::STRING, # doesn't matter
104
+ [Types::STRING],
105
+ Types::NILCLASS).should == Frequency::NEVER
106
+ end
107
+
108
+ it 'should infer a potential raises by argument type' do
109
+ g = cfg <<-EOF
110
+ class RInfer3
111
+ def initialize(x)
112
+ try_to_foo(x) if x != 0
113
+ end
114
+
115
+ def try_to_foo(x)
116
+ case x
117
+ when Integer
118
+ raise ArgumentError.new('no negative numbers') if x < 0
119
+ when Float
120
+ raise TypeError.new('no floats at all')
121
+ else
122
+ x.ljust(20)
123
+ end
124
+ end
125
+ end
126
+ def make_RInfer_3(x)
127
+ RInfer3.new(x)
128
+ end
129
+ EOF
130
+ method = ClassRegistry['Object'].instance_method(:make_RInfer_3)
131
+ # call make_rinfer_2 should raise for a fixnum
132
+ method.raise_frequency_for_types(
133
+ Types::STRING, # doesn't matter
134
+ [Types::FLOAT],
135
+ Types::NILCLASS).should == Frequency::MAYBE
136
+ method.raise_frequency_for_types(
137
+ Types::STRING, # doesn't matter
138
+ [ClassRegistry['Bignum'].as_type],
139
+ Types::NILCLASS).should == Frequency::MAYBE
140
+ method.raise_frequency_for_types(
141
+ Types::STRING, # doesn't matter
142
+ [Types::ARRAY],
143
+ Types::NILCLASS).should == Frequency::MAYBE # not smart enough to prove != 0 yet
144
+ method.raise_frequency_for_types(
145
+ Types::STRING, # doesn't matter
146
+ [Types::STRING],
147
+ Types::NILCLASS).should == Frequency::NEVER
148
+ end
149
+
150
+ it 'can infer raises from calls to the annotated String class' do
151
+ g = cfg <<-EOF
152
+ class RInfer4
153
+ def silly(x)
154
+ x.getbyte(x.size * 2)
155
+ end
156
+ end
157
+ EOF
158
+ method = ClassRegistry['RInfer4'].instance_method(:silly)
159
+ method.raise_frequency_for_types(
160
+ Utilities.type_for(ClassRegistry['RInfer4']),
161
+ [Types::STRING],
162
+ Types::NILCLASS).should == Frequency::MAYBE
163
+ method.raise_frequency_for_types(
164
+ Utilities.type_for(ClassRegistry['RInfer4']),
165
+ [Types::FIXNUM],
166
+ Types::NILCLASS).should == Frequency::ALWAYS
167
+ end
168
+
169
+ it 'can infer a guaranteed NoMethodError from privacy violations' do
170
+ g = cfg <<-EOF
171
+ class RInfer5
172
+ def foo
173
+ end
174
+ private :foo
175
+
176
+ def bar
177
+ self.foo # error!
178
+ end
179
+ end
180
+ EOF
181
+ method = ClassRegistry['RInfer5'].instance_method(:bar)
182
+ method.raise_frequency_for_types(
183
+ Utilities.type_for(ClassRegistry['RInfer5'])).should == Frequency::ALWAYS
184
+ end
185
+
186
+ it 'can infer a potential lookup failure when a successful one exists' do
187
+ g = cfg <<-EOF
188
+ class RInfer6
189
+ def bar
190
+ if gets.size > 0
191
+ x = 'hello'
192
+ else
193
+ x = 5
194
+ end
195
+ x.intern # error sometimes
196
+ end
197
+ end
198
+ EOF
199
+ method = ClassRegistry['RInfer6'].instance_method(:bar)
200
+ method.raise_frequency_for_types(
201
+ Utilities.type_for(ClassRegistry['RInfer6'])).should == Frequency::MAYBE
202
+ end
203
+
204
+ it 'can infer an ArgumentError when invalid arities are given' do
205
+ g = cfg <<-EOF
206
+ class RInfer7
207
+ def foo(*args)
208
+ bar(*args)
209
+ end
210
+ def bar(a, b=1, c=2, d)
211
+ a
212
+ end
213
+ end
214
+ EOF
215
+ method = ClassRegistry['RInfer7'].instance_method(:foo)
216
+ method.raise_frequency_for_types(
217
+ ClassRegistry['RInfer7'].as_type).should == Frequency::ALWAYS
218
+ method.raise_frequency_for_types(
219
+ ClassRegistry['RInfer7'].as_type,
220
+ [Types::STRING]).should == Frequency::ALWAYS
221
+ method.raise_frequency_for_types(
222
+ ClassRegistry['RInfer7'].as_type,
223
+ [Types::STRING, Types::FIXNUM]).should == Frequency::NEVER
224
+ method.raise_frequency_for_types(
225
+ ClassRegistry['RInfer7'].as_type,
226
+ [Types::STRING, Types::FIXNUM,
227
+ Types::BIGNUM]).should == Frequency::NEVER
228
+ method.raise_frequency_for_types(
229
+ ClassRegistry['RInfer7'].as_type,
230
+ [Types::STRING, Types::FIXNUM,
231
+ Types::BIGNUM, Types::ARRAY]).should == Frequency::NEVER
232
+ method.raise_frequency_for_types(
233
+ ClassRegistry['RInfer7'].as_type,
234
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM,
235
+ Types::ARRAY, Types::HASH]).should == Frequency::ALWAYS
236
+ end
237
+
238
+ it 'can infer guaranteed errors when super provides incorrect arities' do
239
+ g = cfg <<-EOF
240
+ class RInfer8
241
+ def foo(a, b=1, c=2, d)
242
+ a
243
+ end
244
+ end
245
+ class RInfer8B < RInfer8
246
+ def foo(*args)
247
+ super(*args)
248
+ end
249
+ end
250
+ EOF
251
+ method = ClassRegistry['RInfer8B'].instance_method(:foo)
252
+ method.raise_frequency_for_types(
253
+ ClassRegistry['RInfer8B'].as_type).should == Frequency::ALWAYS
254
+ method.raise_frequency_for_types(
255
+ ClassRegistry['RInfer8B'].as_type,
256
+ [Types::STRING]).should == Frequency::ALWAYS
257
+ method.raise_frequency_for_types(
258
+ ClassRegistry['RInfer8B'].as_type,
259
+ [Types::STRING, Types::FIXNUM]).should == Frequency::NEVER
260
+ method.raise_frequency_for_types(
261
+ ClassRegistry['RInfer8B'].as_type,
262
+ [Types::STRING, Types::FIXNUM,
263
+ Types::BIGNUM]).should == Frequency::NEVER
264
+ method.raise_frequency_for_types(
265
+ ClassRegistry['RInfer8B'].as_type,
266
+ [Types::STRING, Types::FIXNUM,
267
+ Types::BIGNUM, Types::ARRAY]).should == Frequency::NEVER
268
+ method.raise_frequency_for_types(
269
+ ClassRegistry['RInfer8B'].as_type,
270
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM,
271
+ Types::ARRAY, Types::HASH]).should == Frequency::ALWAYS
272
+ end
273
+
274
+ it 'can infer guaranteed errors when zsuper provides incorrect arities' do
275
+ g = cfg <<-EOF
276
+ class RInfer9
277
+ def foo(a, b=1, c=2, d)
278
+ a
279
+ end
280
+ end
281
+ class RInfer9B < RInfer9
282
+ def foo(*args)
283
+ super
284
+ end
285
+ end
286
+ EOF
287
+ method = ClassRegistry['RInfer9B'].instance_method(:foo)
288
+ method.raise_frequency_for_types(
289
+ ClassRegistry['RInfer9B'].as_type).should == Frequency::ALWAYS
290
+ method.raise_frequency_for_types(
291
+ ClassRegistry['RInfer9B'].as_type,
292
+ [Types::STRING]).should == Frequency::ALWAYS
293
+ method.raise_frequency_for_types(
294
+ ClassRegistry['RInfer9B'].as_type,
295
+ [Types::STRING, Types::FIXNUM]).should == Frequency::NEVER
296
+ method.raise_frequency_for_types(
297
+ ClassRegistry['RInfer9B'].as_type,
298
+ [Types::STRING, Types::FIXNUM,
299
+ Types::BIGNUM]).should == Frequency::NEVER
300
+ method.raise_frequency_for_types(
301
+ ClassRegistry['RInfer9B'].as_type,
302
+ [Types::STRING, Types::FIXNUM,
303
+ Types::BIGNUM, Types::ARRAY]).should == Frequency::NEVER
304
+ method.raise_frequency_for_types(
305
+ ClassRegistry['RInfer9B'].as_type,
306
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM,
307
+ Types::ARRAY, Types::HASH]).should == Frequency::ALWAYS
308
+ end
309
+ end
310
+
@@ -0,0 +1,301 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe 'CFG-based raise type inference' do
4
+ it 'should infer types based on specified overloads' do
5
+ g = cfg <<-EOF
6
+ class RI1
7
+ def tap_10
8
+ yield 10
9
+ 10
10
+ end
11
+ end
12
+ EOF
13
+ method = ClassRegistry['RI1'].instance_method(:tap_10)
14
+ method.raise_type_for_types(
15
+ Utilities.type_for(ClassRegistry['RI1'])).should equal_type(
16
+ Types::UnionType.new([Types::ClassType.new('LocalJumpError', :invariant)]))
17
+ end
18
+
19
+ it 'should infer types based on raising a string' do
20
+ g = cfg <<-EOF
21
+ class RI2
22
+ def raise_string
23
+ raise 'foo'
24
+ end
25
+ end
26
+ EOF
27
+ method = ClassRegistry['RI2'].instance_method(:raise_string)
28
+ method.raise_type_for_types(
29
+ Utilities.type_for(ClassRegistry['RI2'])).should equal_type(
30
+ Types::UnionType.new([Types::ClassType.new('RuntimeError', :invariant)]))
31
+ end
32
+
33
+ it 'should infer types based on raising an Exception class' do
34
+ g = cfg <<-EOF
35
+ class RI3
36
+ def raise_class
37
+ raise TypeError
38
+ end
39
+ end
40
+ EOF
41
+ method = ClassRegistry['RI3'].instance_method(:raise_class)
42
+ method.raise_type_for_types(
43
+ Utilities.type_for(ClassRegistry['RI3'])).should equal_type(
44
+ Types::UnionType.new([Types::ClassType.new('TypeError', :invariant)]))
45
+ end
46
+
47
+ it 'should infer types based on raising an Exception instance' do
48
+ g = cfg <<-EOF
49
+ class RI4
50
+ def raise_instance
51
+ raise ArgumentError.new('foo')
52
+ end
53
+ end
54
+ EOF
55
+ method = ClassRegistry['RI4'].instance_method(:raise_instance)
56
+ method.raise_type_for_types(
57
+ Utilities.type_for(ClassRegistry['RI4'])).should equal_type(
58
+ Types::UnionType.new([Types::ClassType.new('ArgumentError', :invariant)]))
59
+ end
60
+
61
+ it 'should infer raises from #initialize when calling Class.new' do
62
+ g = cfg <<-EOF
63
+ class RTInfer2
64
+ def initialize(x)
65
+ raise TypeError.new("I don't like integers") if Integer === x
66
+ end
67
+ end
68
+ def make_rtinfer_2(x)
69
+ RTInfer2.new(x)
70
+ end
71
+ EOF
72
+ method = ClassRegistry['Object'].instance_method(:make_rtinfer_2)
73
+ # call make_rinfer_2 should raise for a fixnum
74
+ method.raise_type_for_types(
75
+ Types::STRING, # doesn't matter
76
+ [Types::FIXNUM],
77
+ Types::NILCLASS).should equal_type(ClassRegistry['TypeError'].as_type)
78
+ method.raise_type_for_types(
79
+ Types::STRING, # doesn't matter
80
+ [ClassRegistry['Bignum'].as_type],
81
+ Types::NILCLASS).should equal_type(ClassRegistry['TypeError'].as_type)
82
+ method.raise_type_for_types(
83
+ Types::STRING, # doesn't matter
84
+ [Types::STRING],
85
+ Types::NILCLASS).should equal_type(Types::EMPTY)
86
+ end
87
+
88
+ it 'should infer a potential raises by argument type' do
89
+ g = cfg <<-EOF
90
+ class RTInfer3
91
+ def initialize(x)
92
+ try_to_foo(x) if x != 0
93
+ end
94
+
95
+ def try_to_foo(x)
96
+ case x
97
+ when Integer
98
+ raise ArgumentError.new('no negative numbers') if x < 0
99
+ when Float
100
+ raise TypeError.new('no floats at all')
101
+ else
102
+ x.ljust(20)
103
+ end
104
+ end
105
+ end
106
+ def make_rtinfer_3(x)
107
+ RTInfer3.new(x)
108
+ end
109
+ EOF
110
+ method = ClassRegistry['Object'].instance_method(:make_rtinfer_3)
111
+ # call make_rinfer_2 should raise for a fixnum
112
+ method.raise_type_for_types(
113
+ Types::STRING, # doesn't matter
114
+ [Types::FLOAT],
115
+ Types::NILCLASS).should equal_type(ClassRegistry['TypeError'].as_type)
116
+ method.raise_type_for_types(
117
+ Types::STRING, # doesn't matter
118
+ [ClassRegistry['Bignum'].as_type],
119
+ Types::NILCLASS).should equal_type(ClassRegistry['ArgumentError'].as_type)
120
+ method.raise_type_for_types(
121
+ Types::STRING, # doesn't matter
122
+ [Types::ARRAY],
123
+ Types::NILCLASS).should equal_type(ClassRegistry['NoMethodError'].as_type)
124
+ method.raise_type_for_types(
125
+ Types::STRING, # doesn't matter
126
+ [Types::STRING],
127
+ Types::NILCLASS).should equal_type(Types::EMPTY)
128
+ end
129
+
130
+ it 'can infer raises from calls to the annotated String class' do
131
+ g = cfg <<-EOF
132
+ class RTInfer4
133
+ def silly(x)
134
+ x.getbyte(x.size * 2)
135
+ end
136
+ end
137
+ EOF
138
+ method = ClassRegistry['RTInfer4'].instance_method(:silly)
139
+ method.raise_type_for_types(
140
+ Utilities.type_for(ClassRegistry['RTInfer4']),
141
+ [Types::STRING],
142
+ Types::NILCLASS).should equal_type(ClassRegistry['IndexError'].as_type |
143
+ ClassRegistry['TypeError'].as_type)
144
+ method.raise_type_for_types(
145
+ Utilities.type_for(ClassRegistry['RTInfer4']),
146
+ [Types::FIXNUM],
147
+ Types::NILCLASS).should equal_type(ClassRegistry['NoMethodError'].as_type)
148
+ end
149
+
150
+ it 'can infer a guaranteed NoMethodError from privacy violations' do
151
+ g = cfg <<-EOF
152
+ class RTInfer5
153
+ def foo
154
+ end
155
+ private :foo
156
+
157
+ def bar
158
+ self.foo # error!
159
+ end
160
+ end
161
+ EOF
162
+ method = ClassRegistry['RTInfer5'].instance_method(:bar)
163
+ method.raise_type_for_types(
164
+ Utilities.type_for(ClassRegistry['RTInfer5'])).should(
165
+ equal_type(ClassRegistry['NoMethodError'].as_type))
166
+ end
167
+
168
+ it 'can infer a potential lookup failure when a successful one exists' do
169
+ g = cfg <<-EOF
170
+ class RTInfer6
171
+ def bar
172
+ if gets.size > 0
173
+ x = 'hello'
174
+ else
175
+ x = 5
176
+ end
177
+ x.intern # error sometimes
178
+ end
179
+ end
180
+ EOF
181
+ method = ClassRegistry['RTInfer6'].instance_method(:bar)
182
+ method.raise_type_for_types(
183
+ Utilities.type_for(ClassRegistry['RTInfer6'])).should(
184
+ equal_type(ClassRegistry['NoMethodError'].as_type))
185
+ end
186
+
187
+ it 'can infer an ArgumentError when invalid arities are given' do
188
+ g = cfg <<-EOF
189
+ class RTInfer7
190
+ def foo(*args)
191
+ bar(*args)
192
+ end
193
+ def bar(a, b=1, c=2, d)
194
+ a
195
+ end
196
+ end
197
+ EOF
198
+ method = ClassRegistry['RTInfer7'].instance_method(:foo)
199
+ method.raise_type_for_types(
200
+ ClassRegistry['RTInfer7'].as_type).should(
201
+ equal_type(ClassRegistry['ArgumentError'].as_type))
202
+ method.raise_type_for_types(
203
+ ClassRegistry['RTInfer7'].as_type,
204
+ [Types::STRING]).should(
205
+ equal_type(ClassRegistry['ArgumentError'].as_type))
206
+ method.raise_type_for_types(
207
+ ClassRegistry['RTInfer7'].as_type,
208
+ [Types::STRING, Types::FIXNUM]).should(
209
+ equal_type(Types::EMPTY))
210
+ method.raise_type_for_types(
211
+ ClassRegistry['RTInfer7'].as_type,
212
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM]).should(
213
+ equal_type(Types::EMPTY))
214
+ method.raise_type_for_types(
215
+ ClassRegistry['RTInfer7'].as_type,
216
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM, Types::ARRAY]).should(
217
+ equal_type(Types::EMPTY))
218
+ method.raise_type_for_types(
219
+ ClassRegistry['RTInfer7'].as_type,
220
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM, Types::ARRAY, Types::HASH]).should(
221
+ equal_type(ClassRegistry['ArgumentError'].as_type))
222
+ end
223
+
224
+ it 'can infer an ArgumentError when super provides incorrect arities' do
225
+ g = cfg <<-EOF
226
+ class RTInfer8
227
+ def foo(a, b=1, c=2, d)
228
+ a
229
+ end
230
+ end
231
+ class RTInfer8B < RTInfer8
232
+ def foo(*args)
233
+ super(*args)
234
+ end
235
+ end
236
+ EOF
237
+ method = ClassRegistry['RTInfer8B'].instance_method(:foo)
238
+ method.raise_type_for_types(
239
+ ClassRegistry['RTInfer8B'].as_type).should(
240
+ equal_type(ClassRegistry['ArgumentError'].as_type))
241
+ method.raise_type_for_types(
242
+ ClassRegistry['RTInfer8B'].as_type,
243
+ [Types::STRING]).should(
244
+ equal_type(ClassRegistry['ArgumentError'].as_type))
245
+ method.raise_type_for_types(
246
+ ClassRegistry['RTInfer8B'].as_type,
247
+ [Types::STRING, Types::FIXNUM]).should(
248
+ equal_type(Types::EMPTY))
249
+ method.raise_type_for_types(
250
+ ClassRegistry['RTInfer8B'].as_type,
251
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM]).should(
252
+ equal_type(Types::EMPTY))
253
+ method.raise_type_for_types(
254
+ ClassRegistry['RTInfer8B'].as_type,
255
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM, Types::ARRAY]).should(
256
+ equal_type(Types::EMPTY))
257
+ method.raise_type_for_types(
258
+ ClassRegistry['RTInfer8B'].as_type,
259
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM, Types::ARRAY, Types::HASH]).should(
260
+ equal_type(ClassRegistry['ArgumentError'].as_type))
261
+ end
262
+
263
+ it 'can infer an ArgumentError when zsuper provides incorrect arities' do
264
+ g = cfg <<-EOF
265
+ class RTInfer9
266
+ def foo(a, b=1, c=2, d)
267
+ a
268
+ end
269
+ end
270
+ class RTInfer9B < RTInfer9
271
+ def foo(*args)
272
+ super
273
+ end
274
+ end
275
+ EOF
276
+ method = ClassRegistry['RTInfer9B'].instance_method(:foo)
277
+ method.raise_type_for_types(
278
+ ClassRegistry['RTInfer9B'].as_type).should(
279
+ equal_type(ClassRegistry['ArgumentError'].as_type))
280
+ method.raise_type_for_types(
281
+ ClassRegistry['RTInfer9B'].as_type,
282
+ [Types::STRING]).should(
283
+ equal_type(ClassRegistry['ArgumentError'].as_type))
284
+ method.raise_type_for_types(
285
+ ClassRegistry['RTInfer9B'].as_type,
286
+ [Types::STRING, Types::FIXNUM]).should(
287
+ equal_type(Types::EMPTY))
288
+ method.raise_type_for_types(
289
+ ClassRegistry['RTInfer9B'].as_type,
290
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM]).should(
291
+ equal_type(Types::EMPTY))
292
+ method.raise_type_for_types(
293
+ ClassRegistry['RTInfer9B'].as_type,
294
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM, Types::ARRAY]).should(
295
+ equal_type(Types::EMPTY))
296
+ method.raise_type_for_types(
297
+ ClassRegistry['RTInfer9B'].as_type,
298
+ [Types::STRING, Types::FIXNUM, Types::BIGNUM, Types::ARRAY, Types::HASH]).should(
299
+ equal_type(ClassRegistry['ArgumentError'].as_type))
300
+ end
301
+ end