solargraph 0.59.0 → 0.59.2

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linting.yml +6 -0
  3. data/.github/workflows/plugins.yml +9 -1
  4. data/.github/workflows/typecheck.yml +3 -1
  5. data/CHANGELOG.md +12 -0
  6. data/lib/solargraph/api_map/store.rb +1 -2
  7. data/lib/solargraph/api_map.rb +4 -6
  8. data/lib/solargraph/complex_type/type_methods.rb +1 -0
  9. data/lib/solargraph/complex_type/unique_type.rb +14 -15
  10. data/lib/solargraph/complex_type.rb +2 -1
  11. data/lib/solargraph/convention/active_support_concern.rb +111 -111
  12. data/lib/solargraph/convention/base.rb +50 -50
  13. data/lib/solargraph/diagnostics.rb +55 -55
  14. data/lib/solargraph/environ.rb +52 -52
  15. data/lib/solargraph/gem_pins.rb +0 -11
  16. data/lib/solargraph/language_server/host.rb +6 -7
  17. data/lib/solargraph/language_server/message/extended/environment.rb +25 -25
  18. data/lib/solargraph/language_server/message/initialized.rb +28 -28
  19. data/lib/solargraph/language_server/message/text_document.rb +28 -28
  20. data/lib/solargraph/language_server/progress.rb +143 -143
  21. data/lib/solargraph/language_server/transport/adapter.rb +68 -68
  22. data/lib/solargraph/language_server.rb +20 -20
  23. data/lib/solargraph/parser/parser_gem/node_chainer.rb +1 -0
  24. data/lib/solargraph/parser/parser_gem/node_methods.rb +91 -4
  25. data/lib/solargraph/parser/parser_gem/node_processors/alias_node.rb +24 -24
  26. data/lib/solargraph/parser/parser_gem/node_processors/casgn_node.rb +36 -36
  27. data/lib/solargraph/parser/parser_gem/node_processors/cvasgn_node.rb +24 -24
  28. data/lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb +24 -24
  29. data/lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb +40 -40
  30. data/lib/solargraph/parser/parser_gem/node_processors/sym_node.rb +20 -20
  31. data/lib/solargraph/pin/base.rb +3 -3
  32. data/lib/solargraph/pin/method.rb +2 -0
  33. data/lib/solargraph/pin/parameter.rb +3 -1
  34. data/lib/solargraph/pin/reference/require.rb +14 -14
  35. data/lib/solargraph/pin/search.rb +5 -5
  36. data/lib/solargraph/pin/singleton.rb +11 -11
  37. data/lib/solargraph/rbs_map/conversions.rb +15 -8
  38. data/lib/solargraph/shell.rb +1 -1
  39. data/lib/solargraph/source/chain/array.rb +1 -12
  40. data/lib/solargraph/source/chain/block_symbol.rb +13 -13
  41. data/lib/solargraph/source/chain/block_variable.rb +13 -13
  42. data/lib/solargraph/source/chain/head.rb +19 -19
  43. data/lib/solargraph/source/chain/literal.rb +18 -14
  44. data/lib/solargraph/source/cursor.rb +11 -2
  45. data/lib/solargraph/source/source_chainer.rb +4 -4
  46. data/lib/solargraph/source_map/clip.rb +6 -1
  47. data/lib/solargraph/type_checker.rb +4 -4
  48. data/lib/solargraph/version.rb +1 -1
  49. data/lib/solargraph/yard_map/cache.rb +25 -25
  50. data/lib/solargraph/yard_map/mapper/to_constant.rb +28 -28
  51. data/lib/solargraph/yard_map/mapper/to_method.rb +1 -1
  52. data/lib/solargraph.rb +2 -2
  53. metadata +1 -2
  54. data/rbs/fills/tuple/tuple.rbs +0 -177
@@ -1,36 +1,36 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module Parser
5
- module ParserGem
6
- module NodeProcessors
7
- class CasgnNode < Parser::NodeProcessor::Base
8
- include ParserGem::NodeMethods
9
-
10
- def process
11
- pins.push Solargraph::Pin::Constant.new(
12
- location: get_node_location(node),
13
- closure: region.closure,
14
- name: const_name,
15
- comments: comments_for(node),
16
- assignment: node.children[2],
17
- source: :parser
18
- )
19
- process_children
20
- end
21
-
22
- private
23
-
24
- # @return [String]
25
- def const_name
26
- if node.children[0]
27
- Parser::NodeMethods.unpack_name(node.children[0]) + "::#{node.children[1]}"
28
- else
29
- node.children[1].to_s
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Parser
5
+ module ParserGem
6
+ module NodeProcessors
7
+ class CasgnNode < Parser::NodeProcessor::Base
8
+ include ParserGem::NodeMethods
9
+
10
+ def process
11
+ pins.push Solargraph::Pin::Constant.new(
12
+ location: get_node_location(node),
13
+ closure: region.closure,
14
+ name: const_name,
15
+ comments: comments_for(node),
16
+ assignment: node.children[2],
17
+ source: :parser
18
+ )
19
+ process_children
20
+ end
21
+
22
+ private
23
+
24
+ # @return [String]
25
+ def const_name
26
+ if node.children[0]
27
+ Parser::NodeMethods.unpack_name(node.children[0]) + "::#{node.children[1]}"
28
+ else
29
+ node.children[1].to_s
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,24 +1,24 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module Parser
5
- module ParserGem
6
- module NodeProcessors
7
- class CvasgnNode < Parser::NodeProcessor::Base
8
- def process
9
- loc = get_node_location(node)
10
- pins.push Solargraph::Pin::ClassVariable.new(
11
- location: loc,
12
- closure: region.closure,
13
- name: node.children[0].to_s,
14
- comments: comments_for(node),
15
- assignment: node.children[1],
16
- source: :parser
17
- )
18
- process_children
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Parser
5
+ module ParserGem
6
+ module NodeProcessors
7
+ class CvasgnNode < Parser::NodeProcessor::Base
8
+ def process
9
+ loc = get_node_location(node)
10
+ pins.push Solargraph::Pin::ClassVariable.new(
11
+ location: loc,
12
+ closure: region.closure,
13
+ name: node.children[0].to_s,
14
+ comments: comments_for(node),
15
+ assignment: node.children[1],
16
+ source: :parser
17
+ )
18
+ process_children
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,24 +1,24 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module Parser
5
- module ParserGem
6
- module NodeProcessors
7
- class GvasgnNode < Parser::NodeProcessor::Base
8
- def process
9
- loc = get_node_location(node)
10
- pins.push Solargraph::Pin::GlobalVariable.new(
11
- location: loc,
12
- closure: region.closure,
13
- name: node.children[0].to_s,
14
- comments: comments_for(node),
15
- assignment: node.children[1],
16
- source: :parser
17
- )
18
- process_children
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Parser
5
+ module ParserGem
6
+ module NodeProcessors
7
+ class GvasgnNode < Parser::NodeProcessor::Base
8
+ def process
9
+ loc = get_node_location(node)
10
+ pins.push Solargraph::Pin::GlobalVariable.new(
11
+ location: loc,
12
+ closure: region.closure,
13
+ name: node.children[0].to_s,
14
+ comments: comments_for(node),
15
+ assignment: node.children[1],
16
+ source: :parser
17
+ )
18
+ process_children
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,40 +1,40 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module Parser
5
- module ParserGem
6
- module NodeProcessors
7
- class NamespaceNode < Parser::NodeProcessor::Base
8
- include ParserGem::NodeMethods
9
-
10
- def process
11
- superclass_name = nil
12
- superclass_name = unpack_name(node.children[1]) if node.type == :class && node.children[1]&.type == :const
13
-
14
- loc = get_node_location(node)
15
- nspin = Solargraph::Pin::Namespace.new(
16
- type: node.type,
17
- location: loc,
18
- closure: region.closure,
19
- name: unpack_name(node.children[0]),
20
- comments: comments_for(node),
21
- visibility: :public,
22
- gates: region.closure.gates.freeze,
23
- source: :parser
24
- )
25
- pins.push nspin
26
- unless superclass_name.nil?
27
- pins.push Pin::Reference::Superclass.new(
28
- location: loc,
29
- closure: pins.last,
30
- name: superclass_name,
31
- source: :parser
32
- )
33
- end
34
- process_children region.update(closure: nspin, visibility: :public)
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Parser
5
+ module ParserGem
6
+ module NodeProcessors
7
+ class NamespaceNode < Parser::NodeProcessor::Base
8
+ include ParserGem::NodeMethods
9
+
10
+ def process
11
+ superclass_name = nil
12
+ superclass_name = unpack_name(node.children[1]) if node.type == :class && node.children[1]&.type == :const
13
+
14
+ loc = get_node_location(node)
15
+ nspin = Solargraph::Pin::Namespace.new(
16
+ type: node.type,
17
+ location: loc,
18
+ closure: region.closure,
19
+ name: unpack_name(node.children[0]),
20
+ comments: comments_for(node),
21
+ visibility: :public,
22
+ gates: region.closure.gates.freeze,
23
+ source: :parser
24
+ )
25
+ pins.push nspin
26
+ unless superclass_name.nil?
27
+ pins.push Pin::Reference::Superclass.new(
28
+ location: loc,
29
+ closure: pins.last,
30
+ name: superclass_name,
31
+ source: :parser
32
+ )
33
+ end
34
+ process_children region.update(closure: nspin, visibility: :public)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,20 +1,20 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module Parser
5
- module ParserGem
6
- module NodeProcessors
7
- class SymNode < Parser::NodeProcessor::Base
8
- # @return [void]
9
- def process
10
- pins.push Solargraph::Pin::Symbol.new(
11
- get_node_location(node),
12
- ":#{node.children[0]}",
13
- source: :parser
14
- )
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Parser
5
+ module ParserGem
6
+ module NodeProcessors
7
+ class SymNode < Parser::NodeProcessor::Base
8
+ # @return [void]
9
+ def process
10
+ pins.push Solargraph::Pin::Symbol.new(
11
+ get_node_location(node),
12
+ ":#{node.children[0]}",
13
+ source: :parser
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -293,7 +293,7 @@ module Solargraph
293
293
  # @param attr [::Symbol]
294
294
  # @return [void]
295
295
  # @todo strong typechecking should complain when there are no block-related tags
296
- def assert_same_array_content other, attr, &block
296
+ def assert_same_array_content(other, attr, &)
297
297
  arr1 = send(attr)
298
298
  raise "Expected #{attr} on #{self} to be an Enumerable, got #{arr1.class}" unless arr1.is_a?(::Enumerable)
299
299
  # @type arr1 [::Enumerable]
@@ -302,9 +302,9 @@ module Solargraph
302
302
  # @type arr2 [::Enumerable]
303
303
 
304
304
  # @type [undefined]
305
- values1 = arr1.map(&block)
305
+ values1 = arr1.map(&)
306
306
  # @type [undefined]
307
- values2 = arr2.map(&block)
307
+ values2 = arr2.map(&)
308
308
  # @sg-ignore
309
309
  return arr1 if values1 == values2
310
310
  Solargraph.assert_or_log(:"combine_with_#{attr}",
@@ -508,6 +508,7 @@ module Solargraph
508
508
  # @todo Stubbing this method while we debug an infinite loop bug in Ruby 3.x
509
509
  return same_type_arity_signatures
510
510
 
511
+ # rubocop:disable Lint/UnreachableCode
511
512
  # This is an O(n^2) operation, so bail out if n is not small
512
513
  return same_type_arity_signatures if same_type_arity_signatures.length > 10
513
514
 
@@ -534,6 +535,7 @@ module Solargraph
534
535
  end
535
536
  end
536
537
  end
538
+ # rubocop:enable Lint/UnreachableCode
537
539
  end
538
540
 
539
541
  # @param name [String]
@@ -31,7 +31,9 @@ module Solargraph
31
31
  end
32
32
 
33
33
  def combine_with other, attrs = {}
34
- # Parameters can be combined with local variables
34
+ # Parameters can only be combined with local variables in the same closure
35
+ return self unless other.closure == closure
36
+
35
37
  new_attrs = if other.is_a?(Parameter)
36
38
  {
37
39
  decl: assert_same(other, :decl),
@@ -1,14 +1,14 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module Pin
5
- class Reference
6
- class Require < Reference
7
- def initialize location, name, **splat
8
- # super(location, '', name)
9
- super(location: location, name: name, closure: Pin::ROOT_PIN, **splat)
10
- end
11
- end
12
- end
13
- end
14
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Pin
5
+ class Reference
6
+ class Require < Reference
7
+ def initialize location, name, **splat
8
+ # super(location, '', name)
9
+ super(location: location, name: name, closure: Pin::ROOT_PIN, **splat)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -41,11 +41,11 @@ module Solargraph
41
41
  match = [fuzzy_string_match(pin.path, @query), fuzzy_string_match(pin.name, @query)].max
42
42
  Result.new(match, pin) if match > 0.7
43
43
  end
44
- .compact
45
- # @param a [self]
46
- # @param b [self]
47
- # @sg-ignore https://github.com/castwide/solargraph/pull/1050
48
- .sort { |a, b| b.match <=> a.match }
44
+ .compact
45
+ # @param a [self]
46
+ # @param b [self]
47
+ # @sg-ignore https://github.com/castwide/solargraph/pull/1050
48
+ .sort { |a, b| b.match <=> a.match }
49
49
  .map(&:pin)
50
50
  end
51
51
 
@@ -1,11 +1,11 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module Pin
5
- class Singleton < Closure
6
- def initialize name: '', location: nil, closure: nil, **splat
7
- super
8
- end
9
- end
10
- end
11
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Pin
5
+ class Singleton < Closure
6
+ def initialize name: '', location: nil, closure: nil, **splat
7
+ super
8
+ end
9
+ end
10
+ end
11
+ end
@@ -481,7 +481,7 @@ module Solargraph
481
481
  visibility = VISIBILITY_OVERRIDE[override_key]
482
482
  simple_override_key = [closure.path, scope]
483
483
  visibility ||= VISIBILITY_OVERRIDE[simple_override_key]
484
- if closure.path == 'Kernel' && Kernel.private_instance_methods(false).include?(decl.name)
484
+ if closure.path == 'Kernel' && Kernel.private_method_defined?(decl.name, false)
485
485
  visibility ||= :private
486
486
  end
487
487
  if decl.kind == :singleton_instance
@@ -552,16 +552,19 @@ module Solargraph
552
552
  # @param pin [Pin::Method]
553
553
  # @return [void]
554
554
  def method_def_to_sigs decl, pin
555
+ # rubocop:disable Style/SafeNavigationChainLength
556
+ implicit_nil = decl.overloads.first&.annotations&.map(&:string)&.include?('implicitly-returns-nil') || false
557
+ # rubocop:enable Style/SafeNavigationChainLength
555
558
  # @param overload [RBS::AST::Members::MethodDefinition::Overload]
556
559
  decl.overloads.map do |overload|
557
560
  # @sg-ignore Wrong argument type for Solargraph::RbsMap::Conversions#location_decl_to_pin_location:
558
561
  # location expected RBS::Location, nil, received RBS::Location<:type, :type_params>, RBS::AST::Members::Attribute::loc, nil
559
562
  type_location = location_decl_to_pin_location(overload.method_type.location)
560
563
  generics = type_parameter_names(overload.method_type)
561
- signature_parameters, signature_return_type = parts_of_function(overload.method_type, pin)
564
+ signature_parameters, signature_return_type = parts_of_function(overload.method_type, pin, implicit_nil)
562
565
  rbs_block = overload.method_type.block
563
566
  block = if rbs_block
564
- block_parameters, block_return_type = parts_of_function(rbs_block, pin)
567
+ block_parameters, block_return_type = parts_of_function(rbs_block, pin, implicit_nil)
565
568
  Pin::Signature.new(generics: generics, parameters: block_parameters,
566
569
  return_type: block_return_type, source: :rbs,
567
570
  type_location: type_location, closure: pin)
@@ -588,14 +591,15 @@ module Solargraph
588
591
 
589
592
  # @param type [RBS::MethodType, RBS::Types::Block]
590
593
  # @param pin [Pin::Method]
594
+ # @param implicit_nil [Boolean]
591
595
  # @return [Array(Array<Pin::Parameter>, ComplexType)]
592
- def parts_of_function type, pin
596
+ def parts_of_function type, pin, implicit_nil
593
597
  type_location = pin.type_location
594
598
  if defined?(RBS::Types::UntypedFunction) && type.type.is_a?(RBS::Types::UntypedFunction)
595
599
  return [
596
600
  [Solargraph::Pin::Parameter.new(decl: :restarg, name: 'arg', closure: pin, source: :rbs,
597
601
  type_location: type_location)],
598
- method_type_to_type(type)
602
+ method_type_to_type(type, implicit_nil)
599
603
  ]
600
604
  end
601
605
 
@@ -659,7 +663,7 @@ module Solargraph
659
663
  source: :rbs, type_location: type_location)
660
664
  end
661
665
 
662
- return_type = method_type_to_type(type)
666
+ return_type = method_type_to_type(type, implicit_nil)
663
667
  [parameters, return_type]
664
668
  end
665
669
 
@@ -842,9 +846,12 @@ module Solargraph
842
846
  end
843
847
 
844
848
  # @param type [RBS::MethodType, RBS::Types::Block]
849
+ # @param implicit_nil [Boolean]
845
850
  # @return [ComplexType, ComplexType::UniqueType]
846
- def method_type_to_type type
847
- other_type_to_type type.type.return_type
851
+ def method_type_to_type type, implicit_nil
852
+ tag = other_type_to_type type.type.return_type
853
+ return ComplexType.parse("#{tag}, nil") if tag && implicit_nil
854
+ tag
848
855
  end
849
856
 
850
857
  # @param type [RBS::Types::Bases::Base,Object] RBS type object.
@@ -188,7 +188,7 @@ module Solargraph
188
188
  names.each do |name|
189
189
  if name == 'core'
190
190
  # @sg-ignore cache_core and core? are dynamically defined
191
- PinCache.cache_core(out: $stdout) if !PinCache.core? || options[:rebuild]
191
+ PinCache.cache_core(out: $stdout) # if !PinCache.core? || options[:rebuild]
192
192
  next
193
193
  end
194
194
 
@@ -19,18 +19,7 @@ module Solargraph
19
19
  # @param name_pin [Pin::Base]
20
20
  # @param locals [::Array<Pin::Parameter, Pin::LocalVariable>]
21
21
  def resolve api_map, name_pin, locals
22
- child_types = @children.map do |child|
23
- child.infer(api_map, name_pin, locals).simplify_literals
24
- end
25
- type = if child_types.empty? || child_types.any?(&:undefined?)
26
- ComplexType::UniqueType.new('Array', rooted: true)
27
- elsif child_types.uniq.length == 1 && child_types.first.defined?
28
- ComplexType::UniqueType.new('Array', [], child_types.uniq, rooted: true, parameters_type: :list)
29
- elsif child_types.empty?
30
- ComplexType::UniqueType.new('Array', rooted: true, parameters_type: :list)
31
- else
32
- ComplexType::UniqueType.new('Array', [], child_types, rooted: true, parameters_type: :fixed)
33
- end
22
+ type = ComplexType::UniqueType.new('Array', rooted: true)
34
23
  [Pin::ProxyType.anonymous(type, source: :chain)]
35
24
  end
36
25
  end
@@ -1,13 +1,13 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- class Source
5
- class Chain
6
- class BlockSymbol < Link
7
- def resolve api_map, name_pin, locals
8
- [Pin::ProxyType.anonymous(ComplexType.try_parse('::Proc'), source: :chain)]
9
- end
10
- end
11
- end
12
- end
13
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ class Source
5
+ class Chain
6
+ class BlockSymbol < Link
7
+ def resolve api_map, name_pin, locals
8
+ [Pin::ProxyType.anonymous(ComplexType.try_parse('::Proc'), source: :chain)]
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,13 +1,13 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- class Source
5
- class Chain
6
- class BlockVariable < Link
7
- def resolve api_map, name_pin, locals
8
- [Pin::ProxyType.anonymous(ComplexType.try_parse('::Proc'), source: :chain)]
9
- end
10
- end
11
- end
12
- end
13
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ class Source
5
+ class Chain
6
+ class BlockVariable < Link
7
+ def resolve api_map, name_pin, locals
8
+ [Pin::ProxyType.anonymous(ComplexType.try_parse('::Proc'), source: :chain)]
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,19 +1,19 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- class Source
5
- class Chain
6
- # Chain::Head is a link for ambiguous words, e.g.; `String` can refer to
7
- # either a class (`String`) or a function (`Kernel#String`).
8
- #
9
- # @note Chain::Head is only intended to handle `self` and `super`.
10
- class Head < Link
11
- def resolve api_map, name_pin, locals
12
- return [Pin::ProxyType.anonymous(name_pin.binder, source: :chain)] if word == 'self'
13
- # return super_pins(api_map, name_pin) if word == 'super'
14
- []
15
- end
16
- end
17
- end
18
- end
19
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ class Source
5
+ class Chain
6
+ # Chain::Head is a link for ambiguous words, e.g.; `String` can refer to
7
+ # either a class (`String`) or a function (`Kernel#String`).
8
+ #
9
+ # @note Chain::Head is only intended to handle `self` and `super`.
10
+ class Head < Link
11
+ def resolve api_map, name_pin, locals
12
+ return [Pin::ProxyType.anonymous(name_pin.binder, source: :chain)] if word == 'self'
13
+ # return super_pins(api_map, name_pin) if word == 'super'
14
+ []
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -13,21 +13,25 @@ module Solargraph
13
13
  def initialize type, node
14
14
  super("<#{type}>")
15
15
 
16
- if node.is_a?(::Parser::AST::Node)
17
- # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
18
- if node.type == :true
19
- @value = true
20
- # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
21
- elsif node.type == :false
22
- @value = false
23
- # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
24
- elsif %i[int sym].include?(node.type)
25
- # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
26
- @value = node.children.first
27
- end
28
- end
16
+ # @todo We might be able to do some light inference from literals and
17
+ # tuples as long as literal values are intransitive.
18
+
19
+ # if node.is_a?(::Parser::AST::Node)
20
+ # # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
21
+ # if node.type == :true
22
+ # @value = true
23
+ # # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
24
+ # elsif node.type == :false
25
+ # @value = false
26
+ # # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
27
+ # elsif %i[int sym].include?(node.type)
28
+ # # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
29
+ # @value = node.children.first
30
+ # end
31
+ # end
29
32
  @type = type
30
- @literal_type = ComplexType.try_parse(@value.inspect)
33
+ # @literal_type = ComplexType.try_parse(@value.inspect)
34
+ @literal_type = ComplexType::UNDEFINED
31
35
  @complex_type = ComplexType.try_parse(type)
32
36
  end
33
37