rdl 2.0.0.rc2 → 2.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +7 -1
  3. data/README.md +94 -20
  4. data/lib/rdl.rb +4 -1
  5. data/lib/rdl/config.rb +90 -3
  6. data/lib/rdl/info.rb +16 -0
  7. data/lib/rdl/typecheck.rb +207 -79
  8. data/lib/rdl/types/bot.rb +1 -1
  9. data/lib/rdl/types/dependent_arg.rb +17 -8
  10. data/lib/rdl/types/{finitehash.rb → finite_hash.rb} +3 -29
  11. data/lib/rdl/types/generic.rb +1 -37
  12. data/lib/rdl/types/intersection.rb +1 -0
  13. data/lib/rdl/types/lexer.rex +2 -1
  14. data/lib/rdl/types/lexer.rex.rb +4 -1
  15. data/lib/rdl/types/method.rb +2 -12
  16. data/lib/rdl/types/nominal.rb +1 -22
  17. data/lib/rdl/types/non_null.rb +50 -0
  18. data/lib/rdl/types/parser.racc +3 -1
  19. data/lib/rdl/types/parser.tab.rb +222 -190
  20. data/lib/rdl/types/singleton.rb +1 -6
  21. data/lib/rdl/types/structural.rb +1 -10
  22. data/lib/rdl/types/top.rb +1 -2
  23. data/lib/rdl/types/tuple.rb +3 -19
  24. data/lib/rdl/types/type.rb +223 -0
  25. data/lib/rdl/types/union.rb +12 -2
  26. data/lib/rdl/types/var.rb +4 -1
  27. data/lib/rdl/types/wild_query.rb +1 -0
  28. data/lib/rdl/wrap.rb +199 -169
  29. data/lib/rdl_disable.rb +41 -0
  30. data/lib/rdl_types.rb +1 -4
  31. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/_aliases.rb +0 -0
  32. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/abbrev.rb +0 -0
  33. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/array.rb +56 -56
  34. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/base64.rb +0 -0
  35. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/basic_object.rb +0 -0
  36. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/benchmark.rb +0 -0
  37. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/bigdecimal.rb +0 -0
  38. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/bigmath.rb +0 -0
  39. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/bignum.rb +0 -0
  40. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/class.rb +0 -0
  41. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/complex.rb +0 -0
  42. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/coverage.rb +0 -0
  43. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/csv.rb +0 -0
  44. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/date.rb +0 -0
  45. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/dir.rb +0 -0
  46. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/encoding.rb +0 -0
  47. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/enumerable.rb +0 -0
  48. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/enumerator.rb +0 -0
  49. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/exception.rb +0 -0
  50. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/file.rb +0 -0
  51. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/fileutils.rb +0 -0
  52. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/fixnum.rb +0 -0
  53. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/float.rb +26 -26
  54. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/gem.rb +0 -0
  55. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/hash.rb +0 -0
  56. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/integer.rb +8 -8
  57. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/io.rb +0 -0
  58. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/kernel.rb +12 -11
  59. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/marshal.rb +0 -0
  60. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/matchdata.rb +0 -0
  61. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/math.rb +0 -0
  62. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/module.rb +0 -0
  63. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/nil.rb +0 -0
  64. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/numeric.rb +0 -0
  65. data/lib/types/core-ruby-2.x/object.rb +75 -0
  66. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/pathname.rb +0 -0
  67. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/process.rb +0 -0
  68. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/random.rb +0 -0
  69. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/range.rb +0 -0
  70. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/rational.rb +0 -0
  71. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/regexp.rb +0 -0
  72. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/set.rb +0 -0
  73. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/string.rb +0 -0
  74. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/strscan.rb +0 -0
  75. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/symbol.rb +0 -0
  76. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/time.rb +0 -0
  77. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/uri.rb +0 -0
  78. data/{types/ruby-2.x → lib/types/core-ruby-2.x}/yaml.rb +0 -0
  79. data/lib/types/core.rb +4 -0
  80. data/rdl.gemspec +2 -2
  81. data/test/test_le.rb +77 -35
  82. data/test/test_parser.rb +75 -59
  83. data/test/test_rdl.rb +18 -0
  84. data/test/test_typecheck.rb +73 -4
  85. metadata +54 -57
  86. data/lib/rails_types.rb +0 -1
  87. data/types/rails-4.2.1/fixnum.rb +0 -3
  88. data/types/rails-4.2.1/string.rb +0 -3
  89. data/types/rails-tmp/action_dispatch.rb +0 -406
  90. data/types/rails-tmp/active_record.rb +0 -406
  91. data/types/rails-tmp/devise_contracts.rb +0 -216
  92. data/types/ruby-2.x/object.rb +0 -73
@@ -1,73 +0,0 @@
1
- class Object
2
- rdl_nowrap
3
-
4
- # type :ARGF, ARGF
5
- # type :ARGV, 'Array<String>'
6
- # type :DATA, 'File'
7
- # type :ENV, ENV
8
- # type :FALSE, '%false'
9
- # type :NIL, 'nil'
10
- # type :RUBY_COPYRIGHT, 'String'
11
- # type :RUBY_DESCRIPTION, 'String'
12
- # type :RUBY_ENGINE, 'String'
13
- # type :RUBY_PATCHLEVEL, Fixnum
14
- # type :RUBY_PLATFORM, 'String'
15
- # type :RUBY_RELEASE_DATE, 'String'
16
- # type :RUBY_REVISION, Fixnum
17
- # type :RUBY_VERSION, 'String'
18
- # type :STDERR, 'IO'
19
- # type :STDIN, 'IO'
20
- # type :STDOUT, 'IO'
21
- # type :TOPLEVEL_BINDING, 'Binding'
22
- # type :TRUE, '%true'
23
-
24
- type :!~, '(%any other) -> %bool'
25
- type :<=>, '(%any other) -> Fixnum or nil'
26
- type :===, '(%any other) -> %bool'
27
- type :=~, '(%any other) -> nil'
28
- type :class, '() -> Class'
29
- type :clone, '() -> self'
30
- # type :define_singleton_method, '(XXXX : *XXXX)') # TODO
31
- type :display, '(IO port) -> nil'
32
- type :dup, '() -> self an_object'
33
- type :enum_for, '(?Symbol method, *%any args) -> Enumerator<%any>'
34
- type :enum_for, '(?Symbol method, *%any args) { (*%any args) -> %any } -> Enumerator<%any>'
35
- type :eql?, '(%any other) -> %bool'
36
- # type :extend, '(XXXX : *XXXX)') # TODO
37
- type :freeze, '() -> self'
38
- type :frozen?, '() -> %bool'
39
- type :hash, '() -> Fixnum'
40
- type :inspect, '() -> String'
41
- type :instance_of?, '(Class) -> %bool'
42
- type :instance_variable_defined?, '(Symbol or String) -> %bool'
43
- type :instance_variable_get, '(Symbol or String) -> %any'
44
- type :instance_variable_set, '(Symbol or String, %any) -> %any' # returns 2nd argument
45
- type :instance_variables, '() -> Array<Symbol>'
46
- type :is_a?, '(Class or Module) -> %bool'
47
- type :kind_of?, '(Class) -> %bool'
48
- type :method, '(Symbol) -> Method'
49
- type :methods, '(?%bool regular) -> Array<Symbol>'
50
- type :nil?, '() -> %bool'
51
- type :private_methods, '(?%bool all) -> Array<Symbol>'
52
- type :protected_methods, '(?%bool all) -> Array<Symbol>'
53
- type :public_method, '(Symbol) -> Method'
54
- type :public_methods, '(?%bool all) -> Array<Symbol>'
55
- type :public_send, '(Symbol or String, *%any args) -> %any'
56
- type :remove_instance_variable, '(Symbol) -> %any'
57
- # type :respond_to?, '(Symbol or String, ?%bool include_all) -> %bool'
58
- type :send, '(Symbol or String, *%any args) -> %any', wrap: false # Can't wrap this, used outside wrap switch
59
- type :singleton_class, '() -> Class'
60
- type :singleton_method, '(Symbol) -> Method'
61
- type :singleton_methods, '(?%bool all) -> Array<Symbol>'
62
- type :taint, '() -> self'
63
- type :tainted?, '() -> %bool'
64
- # type :tap, '()') # TODO
65
- type :to_enum, '(?Symbol method, *%any args) -> Enumerator<%any>'
66
- type :to_enum, '(?Symbol method, *%any args) {(*%any args) -> %any} -> Enumerator<%any>'
67
- # TODO: above alias for enum_for?
68
- type :to_s, '() -> String'
69
- type :trust, '() -> self'
70
- type :untaint, '() -> self'
71
- type :untrust, '() -> self'
72
- type :untrusted?, '() -> %bool'
73
- end