steep 1.3.0.pre.2 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-windows.yml +1 -0
  3. data/.github/workflows/ruby.yml +1 -5
  4. data/CHANGELOG.md +12 -0
  5. data/Gemfile.lock +20 -18
  6. data/Gemfile.steep +1 -2
  7. data/Gemfile.steep.lock +4 -5
  8. data/bin/rbs +21 -0
  9. data/bin/setup +1 -1
  10. data/lib/steep/ast/types/class.rb +9 -3
  11. data/lib/steep/ast/types/factory.rb +9 -2
  12. data/lib/steep/ast/types/instance.rb +8 -3
  13. data/lib/steep/ast/types/intersection.rb +6 -2
  14. data/lib/steep/ast/types/literal.rb +1 -1
  15. data/lib/steep/ast/types/logic.rb +1 -3
  16. data/lib/steep/ast/types/name.rb +11 -5
  17. data/lib/steep/ast/types/proc.rb +5 -5
  18. data/lib/steep/ast/types/record.rb +5 -1
  19. data/lib/steep/ast/types/self.rb +8 -2
  20. data/lib/steep/ast/types/tuple.rb +7 -5
  21. data/lib/steep/ast/types/union.rb +10 -4
  22. data/lib/steep/ast/types/var.rb +1 -1
  23. data/lib/steep/interface/substitution.rb +11 -10
  24. data/lib/steep/signature/validator.rb +13 -13
  25. data/lib/steep/type_inference/logic_type_interpreter.rb +2 -2
  26. data/lib/steep/version.rb +1 -1
  27. data/lib/steep.rb +0 -1
  28. data/rbs_collection.steep.lock.yaml +20 -12
  29. data/sig/steep/ast/builtin.rbs +1 -1
  30. data/sig/steep/ast/types/any.rbs +5 -5
  31. data/sig/steep/ast/types/boolean.rbs +6 -6
  32. data/sig/steep/ast/types/bot.rbs +5 -5
  33. data/sig/steep/ast/types/class.rbs +7 -6
  34. data/sig/steep/ast/types/helper.rbs +2 -2
  35. data/sig/steep/ast/types/instance.rbs +6 -5
  36. data/sig/steep/ast/types/intersection.rbs +12 -9
  37. data/sig/steep/ast/types/literal.rbs +6 -4
  38. data/sig/steep/ast/types/logic.rbs +7 -9
  39. data/sig/steep/ast/types/name.rbs +7 -3
  40. data/sig/steep/ast/types/nil.rbs +6 -6
  41. data/sig/steep/ast/types/proc.rbs +8 -3
  42. data/sig/steep/ast/types/record.rbs +7 -8
  43. data/sig/steep/ast/types/self.rbs +7 -6
  44. data/sig/steep/ast/types/top.rbs +6 -6
  45. data/sig/steep/ast/types/tuple.rbs +5 -4
  46. data/sig/steep/ast/types/union.rbs +8 -8
  47. data/sig/steep/ast/types/var.rbs +16 -11
  48. data/sig/steep/ast/types/void.rbs +5 -5
  49. data/sig/steep/ast/types.rbs +5 -26
  50. data/sig/steep/interface/substitution.rbs +9 -9
  51. data/steep.gemspec +3 -2
  52. metadata +25 -11
  53. data/lib/steep/ast/types.rb +0 -62
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 639a97319d661c777702365209eaf5a6ea2632723a509331a03f6f1ef3926148
4
- data.tar.gz: fb6061b52a09fb97c907abff4f69d6c9267eef1c9a3af52fa87fffda9de5d1f0
3
+ metadata.gz: c2625d09ae9d7a818a55ae0452268819aa8ac1b826ae174e9e70f15b7fecfabe
4
+ data.tar.gz: d586054591dc13c5baab2fe07641d7cf4ff3cf25ca7cd3ee8cd5002ca939b0b6
5
5
  SHA512:
6
- metadata.gz: 232ec5b779c018aa9824318e003cd60e3ec3691297903337bb414fff87e757daaacfda2d94fb0c751538dcad194763ad6cb5b072156686bd450d5292d490a2e6
7
- data.tar.gz: b322f5568a1fe5cbc0693a01a7be50d9860e056a9f69325e6c55a9322f2d32f7d1d0889d19e45576ca6f3f9afde9649747d9d02a0e251702f94cd27bf5fae27c
6
+ metadata.gz: a2fe1540caaef3ca4c2147e59dc13e4965a3b1bab7f75228ffc3a36e0763bf755e013fcb42f987de32f077bf027ebe6495eda6408e65fb980c732f60fa3edb27
7
+ data.tar.gz: ac8b0f6f729b9e4f6be0bd35e06b2873ab2190b4e99ba10d87a03ac685990bd7866aa9aabf80e0e38156ab2e368279753557856d2382b6379f8d97503db53052
@@ -14,6 +14,7 @@ jobs:
14
14
  - "2.7"
15
15
  - "3.0"
16
16
  - "3.1"
17
+ - "3.2"
17
18
  task:
18
19
  - test
19
20
  # - test:output Ignored because the order of diagnostics changes somehow
@@ -11,10 +11,10 @@ jobs:
11
11
  strategy:
12
12
  matrix:
13
13
  container_tag:
14
- - "2.6"
15
14
  - "2.7"
16
15
  - "3.0"
17
16
  - "3.1"
17
+ - "3.2"
18
18
  - "master-nightly-focal"
19
19
  task:
20
20
  - test
@@ -25,10 +25,6 @@ jobs:
25
25
  image: rubylang/ruby:${{ matrix.container_tag }}
26
26
  steps:
27
27
  - uses: actions/checkout@v3
28
- - name: Reset bundler
29
- run: |
30
- rm Gemfile.lock Gemfile.steep.lock
31
- if: contains(matrix.container_tag, '2.6')
32
28
  - name: Run test
33
29
  run: |
34
30
  git config --global --add safe.directory /__w/steep/steep
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.3.1 (2023-03-08)
6
+
7
+ ### Miscellaneous
8
+
9
+ * Require rbs-2.8.x ([#732](https://github.com/soutaro/steep/pull/732))
10
+
11
+ ## 1.3.0 (2022-11-25)
12
+
13
+ ### Type checker core
14
+
15
+ * Type check types ([#676](https://github.com/soutaro/steep/pull/676))
16
+
5
17
  ## 1.3.0.pre.2 (2022-11-23)
6
18
 
7
19
  ### Type checker core
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- steep (1.3.0.pre.2)
4
+ steep (1.3.1)
5
5
  activesupport (>= 5.1)
6
6
  csv (>= 3.0.9)
7
7
  fileutils (>= 1.1.0)
@@ -11,8 +11,9 @@ PATH
11
11
  logger (>= 1.3.0)
12
12
  parallel (>= 1.0.0)
13
13
  parser (>= 3.1)
14
+ pathname (>= 0.2.1)
14
15
  rainbow (>= 2.2.2, < 4.0)
15
- rbs (>= 2.8.0.pre)
16
+ rbs (~> 2.8.0)
16
17
  securerandom (>= 0.1)
17
18
  strscan (>= 1.0.0)
18
19
  terminal-table (>= 2, < 4)
@@ -20,51 +21,52 @@ PATH
20
21
  GEM
21
22
  remote: https://rubygems.org/
22
23
  specs:
23
- activesupport (7.0.4)
24
+ activesupport (7.0.4.2)
24
25
  concurrent-ruby (~> 1.0, >= 1.0.2)
25
26
  i18n (>= 1.6, < 2)
26
27
  minitest (>= 5.1)
27
28
  tzinfo (~> 2.0)
28
29
  ast (2.4.2)
29
- concurrent-ruby (1.1.10)
30
- csv (3.2.5)
30
+ concurrent-ruby (1.2.2)
31
+ csv (3.2.6)
31
32
  debase (0.2.5.beta2)
32
33
  debase-ruby_core_source (>= 0.10.12)
33
- debase-ruby_core_source (0.10.16)
34
+ debase-ruby_core_source (3.2.0)
34
35
  ffi (1.15.5)
35
- fileutils (1.6.0)
36
+ fileutils (1.7.0)
36
37
  i18n (1.12.0)
37
38
  concurrent-ruby (~> 1.0)
38
- json (2.6.2)
39
- language_server-protocol (3.17.0.1)
40
- listen (3.7.1)
39
+ json (2.6.3)
40
+ language_server-protocol (3.17.0.3)
41
+ listen (3.8.0)
41
42
  rb-fsevent (~> 0.10, >= 0.10.3)
42
43
  rb-inotify (~> 0.9, >= 0.9.10)
43
- logger (1.5.1)
44
+ logger (1.5.3)
44
45
  minitest (5.16.3)
45
46
  minitest-hooks (1.5.0)
46
47
  minitest (> 5.3)
47
48
  minitest-slow_test (0.2.0)
48
49
  minitest (>= 5.0)
49
50
  parallel (1.22.1)
50
- parser (3.1.2.1)
51
+ parser (3.2.1.1)
51
52
  ast (~> 2.4.1)
53
+ pathname (0.2.1)
52
54
  rainbow (3.1.1)
53
55
  rake (13.0.6)
54
56
  rb-fsevent (0.11.2)
55
57
  rb-inotify (0.10.1)
56
58
  ffi (~> 1.0)
57
- rbs (2.8.0.pre.1)
59
+ rbs (2.8.1)
58
60
  ruby-debug-ide (0.7.3)
59
61
  rake (>= 0.8.1)
60
- securerandom (0.2.0)
61
- stackprof (0.2.22)
62
- strscan (3.0.4)
62
+ securerandom (0.2.2)
63
+ stackprof (0.2.23)
64
+ strscan (3.0.6)
63
65
  terminal-table (3.0.2)
64
66
  unicode-display_width (>= 1.1.1, < 3)
65
- tzinfo (2.0.5)
67
+ tzinfo (2.0.6)
66
68
  concurrent-ruby (~> 1.0)
67
- unicode-display_width (2.3.0)
69
+ unicode-display_width (2.4.2)
68
70
 
69
71
  PLATFORMS
70
72
  ruby
data/Gemfile.steep CHANGED
@@ -1,4 +1,3 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'steep', '~> 1.2.0'
4
- gem "rbs", '~> 2.8.0.pre'
3
+ gem 'steep', '~> 1.3.0.pre'
data/Gemfile.steep.lock CHANGED
@@ -27,9 +27,9 @@ GEM
27
27
  rb-fsevent (0.11.2)
28
28
  rb-inotify (0.10.1)
29
29
  ffi (~> 1.0)
30
- rbs (2.8.0.pre.1)
30
+ rbs (2.8.0)
31
31
  securerandom (0.2.0)
32
- steep (1.2.1)
32
+ steep (1.3.0.pre.2)
33
33
  activesupport (>= 5.1)
34
34
  csv (>= 3.0.9)
35
35
  fileutils (>= 1.1.0)
@@ -40,7 +40,7 @@ GEM
40
40
  parallel (>= 1.0.0)
41
41
  parser (>= 3.1)
42
42
  rainbow (>= 2.2.2, < 4.0)
43
- rbs (>= 2.7.0)
43
+ rbs (>= 2.8.0.pre)
44
44
  securerandom (>= 0.1)
45
45
  strscan (>= 1.0.0)
46
46
  terminal-table (>= 2, < 4)
@@ -55,8 +55,7 @@ PLATFORMS
55
55
  arm64-darwin-21
56
56
 
57
57
  DEPENDENCIES
58
- rbs (~> 2.8.0.pre)
59
- steep (~> 1.2.0)
58
+ steep (~> 1.3.0.pre)
60
59
 
61
60
  BUNDLED WITH
62
61
  2.3.15
data/bin/rbs ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+
3
+ BINSTUB_DIR=$(cd $(dirname $0); pwd)
4
+ GEMFILE=$(readlink -f ${BINSTUB_DIR}/../Gemfile.steep)
5
+ COLLECTION=$(readlink -f ${BINSTUB_DIR}/../rbs_collection.steep.yaml)
6
+ ROOT_DIR=$(readlink -f ${BINSTUB_DIR}/..)
7
+
8
+ RBS="bundle exec --gemfile=${GEMFILE} rbs --collection=${COLLECTION}"
9
+
10
+ if type "rbenv" > /dev/null 2>&1; then
11
+ RBS="rbenv exec ${RBS}"
12
+ else
13
+ if type "rvm" > /dev/null 2>&1; then
14
+ if [ -e ${ROOT_DIR}/.ruby-version ]; then
15
+ RBS="rvm ${ROOT_DIR} do ${RBS}"
16
+ fi
17
+ fi
18
+ fi
19
+
20
+ exec $RBS $@
21
+
data/bin/setup CHANGED
@@ -6,4 +6,4 @@ set -vx
6
6
  bundle install
7
7
 
8
8
  bundle install --gemfile=Gemfile.steep
9
- bundle exec --gemfile=Gemfile.steep rbs --collection=rbs_collection.steep.yaml collection install
9
+ bin/rbs collection install
@@ -27,11 +27,17 @@ module Steep
27
27
  alias eql? ==
28
28
 
29
29
  def subst(s)
30
- s.module_type or raise "Unexpected substitution: #{inspect}"
30
+ if s.module_type
31
+ s.module_type
32
+ else
33
+ self
34
+ end
31
35
  end
32
36
 
33
- def free_variables()
34
- @fvs = Set.new([self])
37
+ @@fvs = Set[instance]
38
+
39
+ def free_variables
40
+ @@fvs
35
41
  end
36
42
 
37
43
  include Helper::NoChild
@@ -204,7 +204,7 @@ module Steep
204
204
  when Logic::Base
205
205
  RBS::Types::Bases::Bool.new(location: type.location)
206
206
  else
207
- raise "Unexpected type given: #{type} (#{type.class})"
207
+ __skip__ = raise "Unexpected type given: #{type} (#{type.class})"
208
208
  end
209
209
  end
210
210
 
@@ -248,7 +248,14 @@ module Steep
248
248
  RBS::AST::TypeParam.new(
249
249
  name: type_param.name,
250
250
  variance: type_param.variance,
251
- upper_bound: type_param.upper_bound&.yield_self {|u| type_1(u) },
251
+ upper_bound: type_param.upper_bound&.yield_self {|u|
252
+ case u_ = type_1(u)
253
+ when RBS::Types::ClassInstance, RBS::Types::ClassSingleton, RBS::Types::Interface
254
+ u_
255
+ else
256
+ raise "`#{u_}` cannot be type parameter upper bound"
257
+ end
258
+ },
252
259
  location: type_param.location
253
260
  ).unchecked!(type_param.unchecked)
254
261
  end
@@ -23,11 +23,16 @@ module Steep
23
23
  alias eql? ==
24
24
 
25
25
  def subst(s)
26
- s.instance_type or raise "Unexpected substitution: #{inspect}"
26
+ if s.instance_type
27
+ s.instance_type
28
+ else
29
+ self
30
+ end
27
31
  end
28
32
 
29
- def free_variables()
30
- @fvs = Set.new([self])
33
+ @@fvs = Set[instance]
34
+ def free_variables
35
+ @@fvs
31
36
  end
32
37
 
33
38
  include Helper::NoChild
@@ -35,7 +35,7 @@ module Steep
35
35
  when 0
36
36
  AST::Types::Top.new(location: location)
37
37
  when 1
38
- tys.first
38
+ tys.first || raise
39
39
  else
40
40
  new(types: dups.to_a, location: location)
41
41
  end
@@ -73,7 +73,11 @@ module Steep
73
73
  include Helper::ChildrenLevel
74
74
 
75
75
  def each_child(&block)
76
- types.each(&block)
76
+ if block
77
+ types.each(&block)
78
+ else
79
+ types.each
80
+ end
77
81
  end
78
82
 
79
83
  def level
@@ -54,7 +54,7 @@ module Steep
54
54
  when false
55
55
  Builtin::FalseClass
56
56
  else
57
- raise "Unexpected literal type: #{value.inspect}"
57
+ raise "Unexpected literal type: #{(_ = value).inspect}"
58
58
  end
59
59
 
60
60
  Name::Instance.new(name: klass.module_name, args: [], location: location)
@@ -9,9 +9,7 @@ module Steep
9
9
  self
10
10
  end
11
11
 
12
- def free_variables
13
- @fvs ||= Set[]
14
- end
12
+ include Helper::NoFreeVariables
15
13
 
16
14
  include Helper::NoChild
17
15
 
@@ -51,14 +51,16 @@ module Steep
51
51
  end
52
52
 
53
53
  def with_location(new_location)
54
- self.class.new(name: name, args: args, location: new_location)
54
+ _ = self.class.new(name: name, args: args, location: new_location)
55
55
  end
56
56
 
57
57
  def subst(s)
58
58
  if free_variables.intersect?(s.domain)
59
- self.class.new(location: location,
60
- name: name,
61
- args: args.map {|a| a.subst(s) })
59
+ _ = self.class.new(
60
+ location: location,
61
+ name: name,
62
+ args: args.map {|a| a.subst(s) }
63
+ )
62
64
  else
63
65
  self
64
66
  end
@@ -73,7 +75,11 @@ module Steep
73
75
  end
74
76
 
75
77
  def each_child(&block)
76
- args.each(&block)
78
+ if block
79
+ args.each(&block)
80
+ else
81
+ args.each
82
+ end
77
83
  end
78
84
 
79
85
  include Helper::ChildrenLevel
@@ -68,10 +68,6 @@ module Steep
68
68
  [0] + level_of_children(children)
69
69
  end
70
70
 
71
- def closed?
72
- type.closed? && (block.nil? || block.closed?) && (self_type ? self_type.closed? : false)
73
- end
74
-
75
71
  def with_location(new_location)
76
72
  self.class.new(location: new_location, block: block, type: type, self_type: self_type)
77
73
  end
@@ -103,7 +99,11 @@ module Steep
103
99
  end
104
100
 
105
101
  def block_required?
106
- block && !block.optional?
102
+ if block
103
+ !block.optional?
104
+ else
105
+ false
106
+ end
107
107
  end
108
108
 
109
109
  def each_child(&block)
@@ -43,7 +43,11 @@ module Steep
43
43
  include Helper::ChildrenLevel
44
44
 
45
45
  def each_child(&block)
46
- elements.each_value(&block)
46
+ if block
47
+ elements.each_value(&block)
48
+ else
49
+ elements.each_value
50
+ end
47
51
  end
48
52
 
49
53
  def level
@@ -29,11 +29,17 @@ module Steep
29
29
  include Helper::NoChild
30
30
 
31
31
  def subst(s)
32
- s.self_type or raise "Unexpected substitution: #{inspect}"
32
+ if s.self_type
33
+ s.self_type
34
+ else
35
+ self
36
+ end
33
37
  end
34
38
 
39
+ @@fvs = Set[instance]
40
+
35
41
  def free_variables
36
- @fvs ||= Set.new([self])
42
+ @@fvs
37
43
  end
38
44
 
39
45
  def level
@@ -31,17 +31,19 @@ module Steep
31
31
  end
32
32
 
33
33
  def free_variables()
34
- @fvs ||= Set.new.tap do |set|
35
- types.each do |type|
36
- set.merge(type.free_variables)
37
- end
34
+ @fvs ||= each_child.with_object(Set[]) do |type, set| #$ Set[variable]
35
+ set.merge(type.free_variables)
38
36
  end
39
37
  end
40
38
 
41
39
  include Helper::ChildrenLevel
42
40
 
43
41
  def each_child(&block)
44
- types.each(&block)
42
+ if block
43
+ types.each(&block)
44
+ else
45
+ types.each
46
+ end
45
47
  end
46
48
 
47
49
  def level
@@ -12,7 +12,9 @@ module Steep
12
12
 
13
13
  def self.build(types:, location: nil)
14
14
  return AST::Types::Bot.new if types.empty?
15
- return types.first if types.size == 1
15
+ if types.size == 1
16
+ return types.first || raise
17
+ end
16
18
 
17
19
  types.flat_map do |type|
18
20
  if type.is_a?(Union)
@@ -36,7 +38,7 @@ module Steep
36
38
  when 0
37
39
  AST::Types::Bot.new
38
40
  when 1
39
- tys.first
41
+ tys.first || raise
40
42
  else
41
43
  new(types: tys, location: location)
42
44
  end
@@ -49,7 +51,7 @@ module Steep
49
51
  end
50
52
 
51
53
  def hash
52
- @hash ||= types.inject(self.class.hash) {|c, type| type.hash ^ c }
54
+ @hash ||= types.inject(self.class.hash) {|c, type| type.hash ^ c } #$ Integer
53
55
  end
54
56
 
55
57
  alias eql? ==
@@ -71,7 +73,11 @@ module Steep
71
73
  end
72
74
 
73
75
  def each_child(&block)
74
- types.each(&block)
76
+ if block
77
+ types.each(&block)
78
+ else
79
+ types.each
80
+ end
75
81
  end
76
82
 
77
83
  include Helper::ChildrenLevel
@@ -22,7 +22,7 @@ module Steep
22
22
  alias eql? ==
23
23
 
24
24
  def self.fresh_name(name)
25
- @mutex ||= Mutex.new
25
+ @mutex ||= Thread::Mutex.new
26
26
 
27
27
  @mutex.synchronize do
28
28
  @max ||= 0
@@ -6,7 +6,7 @@ module Steep
6
6
  attr_reader :types_size
7
7
 
8
8
  def initialize(vars_size:, types_size:)
9
- @var_size = vars_size
9
+ @vars_size = vars_size
10
10
  @types_size = types_size
11
11
 
12
12
  super "Invalid substitution: vars.size=#{vars_size}, types.size=#{types_size}"
@@ -43,15 +43,15 @@ module Steep
43
43
  set = Set.new
44
44
 
45
45
  set.merge(dictionary.keys)
46
- set << AST::Types::Instance.instance unless instance_type.is_a?(AST::Types::Instance)
47
- set << AST::Types::Class.instance unless instance_type.is_a?(AST::Types::Class)
48
- set << AST::Types::Instance.instance unless instance_type.is_a?(AST::Types::Self)
46
+ set << AST::Types::Self.instance if self_type
47
+ set << AST::Types::Class.instance if module_type
48
+ set << AST::Types::Instance.instance if instance_type
49
49
 
50
50
  set
51
51
  end
52
52
 
53
53
  def to_s
54
- a = []
54
+ a = [] #: Array[String]
55
55
 
56
56
  dictionary.each do |x, ty|
57
57
  a << "#{x} -> #{ty}"
@@ -87,12 +87,13 @@ module Steep
87
87
  end
88
88
  end
89
89
 
90
- def self.build(vars, types = nil, instance_type: AST::Types::Instance.instance, module_type: AST::Types::Class.instance, self_type: AST::Types::Self.instance)
90
+ def self.build(vars, types = nil, instance_type: nil, module_type: nil, self_type: nil)
91
91
  types ||= vars.map {|var| AST::Types::Var.fresh(var) }
92
92
 
93
93
  raise InvalidSubstitutionError.new(vars_size: vars.size, types_size: types.size) unless vars.size == types.size
94
94
 
95
- dic = vars.zip(types).each.with_object({}) do |(var, type), d|
95
+ dic = vars.zip(types).each.with_object({}) do |(var, type), d| #$ Hash[Symbol, AST::Types::t]
96
+ type or raise
96
97
  d[var] = type
97
98
  end
98
99
 
@@ -130,9 +131,9 @@ module Steep
130
131
  end
131
132
  end
132
133
 
133
- @instance_type = instance_type.subst(s)
134
- @module_type = module_type.subst(s)
135
- @self_type = self_type.subst(s)
134
+ @instance_type = instance_type.subst(s) if instance_type
135
+ @module_type = module_type.subst(s) if module_type
136
+ @self_type = self_type.subst(s) if self_type
136
137
 
137
138
  self
138
139
  end
@@ -270,9 +270,9 @@ module Steep
270
270
  mixin_constraints(definition, ancestors.included_modules || raise, immediate_self_types: ancestors.self_types).each do |relation, ancestor|
271
271
  checker.check(
272
272
  relation,
273
- self_type: AST::Types::Self.new,
274
- instance_type: AST::Types::Instance.new,
275
- class_type: AST::Types::Class.new,
273
+ self_type: AST::Types::Self.instance,
274
+ instance_type: AST::Types::Instance.instance,
275
+ class_type: AST::Types::Class.instance,
276
276
  constraints: Subtyping::Constraints.empty
277
277
  ).else do
278
278
  raise if ancestor.source.is_a?(Symbol)
@@ -314,16 +314,16 @@ module Steep
314
314
  relation = Subtyping::Relation.new(sub_type: var_type, super_type: parent_type)
315
315
  result1 = checker.check(
316
316
  relation,
317
- self_type: AST::Types::Self.new,
318
- instance_type: AST::Types::Instance.new,
319
- class_type: AST::Types::Class.new,
317
+ self_type: AST::Types::Self.instance,
318
+ instance_type: AST::Types::Instance.instance,
319
+ class_type: AST::Types::Class.instance,
320
320
  constraints: Subtyping::Constraints.empty
321
321
  )
322
322
  result2 = checker.check(
323
323
  relation.flip,
324
- self_type: AST::Types::Self.new,
325
- instance_type: AST::Types::Instance.new,
326
- class_type: AST::Types::Class.new,
324
+ self_type: AST::Types::Self.instance,
325
+ instance_type: AST::Types::Instance.instance,
326
+ class_type: AST::Types::Class.instance,
327
327
  constraints: Subtyping::Constraints.empty
328
328
  )
329
329
 
@@ -362,13 +362,13 @@ module Steep
362
362
  mixin_constraints(definition, ancestors.extended_modules, immediate_self_types: ancestors.self_types).each do |relation, ancestor|
363
363
  checker.check(
364
364
  relation,
365
- self_type: AST::Types::Self.new,
366
- instance_type: AST::Types::Instance.new,
367
- class_type: AST::Types::Class.new,
365
+ self_type: AST::Types::Self.instance ,
366
+ instance_type: AST::Types::Instance.instance,
367
+ class_type: AST::Types::Class.instance,
368
368
  constraints: Subtyping::Constraints.empty
369
369
  ).else do
370
370
  raise if ancestor.source.is_a?(Symbol)
371
-
371
+
372
372
  @errors << Diagnostic::Signature::ModuleSelfTypeError.new(
373
373
  name: name,
374
374
  location: ancestor.source&.location || raise,
@@ -390,14 +390,14 @@ module Steep
390
390
  # 4. none of the above (example: T = String, K = Integer)
391
391
 
392
392
  relation = Subtyping::Relation.new(sub_type: type, super_type: instance_type)
393
- if subtyping.check(relation, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.new, instance_type: AST::Types::Instance.new, class_type: AST::Types::Class.new).success?
393
+ if subtyping.check(relation, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.instance, instance_type: AST::Types::Instance.instance, class_type: AST::Types::Class.instance).success?
394
394
  # 1 or 2. Satisfies the condition, no narrowing because `type` is already more specific than/equals to `instance_type`
395
395
  [
396
396
  [type],
397
397
  []
398
398
  ]
399
399
  else
400
- if subtyping.check(relation.flip, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.new, instance_type: AST::Types::Instance.new, class_type: AST::Types::Class.new).success?
400
+ if subtyping.check(relation.flip, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.instance, instance_type: AST::Types::Instance.instance, class_type: AST::Types::Class.instance).success?
401
401
  # 3. Satisfied the condition, narrows to `instance_type`, but cannot remove it from *falsy* list
402
402
  [
403
403
  [instance_type],
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "1.3.0.pre.2"
2
+ VERSION = "1.3.1"
3
3
  end
data/lib/steep.rb CHANGED
@@ -93,7 +93,6 @@ require "steep/type_inference/type_env_builder"
93
93
  require "steep/type_inference/logic_type_interpreter"
94
94
  require "steep/type_inference/multiple_assignment"
95
95
  require "steep/type_inference/method_call"
96
- require "steep/ast/types"
97
96
 
98
97
  require "steep/index/rbs_index"
99
98
  require "steep/index/signature_symbol_provider"