Module: Solargraph::CoreFills

Defined in:
lib/solargraph/core_fills.rb

Constant Summary collapse

KEYWORDS =
[
  '__ENCODING__', '__LINE__', '__FILE__', 'BEGIN', 'END', 'alias', 'and',
  'begin', 'break', 'case', 'class', 'def', 'defined?', 'do', 'else',
  'elsif', 'end', 'ensure', 'false', 'for', 'if', 'in', 'module', 'next',
  'nil', 'not', 'or', 'redo', 'rescue', 'retry', 'return', 'self', 'super',
  'then', 'true', 'undef', 'unless', 'until', 'when', 'while', 'yield'
].freeze
METHODS_RETURNING_SUBTYPES =
%w[
  Array#[] Array#first Array#last
].freeze
METHODS_RETURNING_VALUE_TYPES =
%w[
  Hash#[]
].freeze
METHODS_WITH_YIELDPARAM_SELF =
%w[
  Object#tap
].freeze
METHODS_WITH_YIELDPARAM_SUBTYPES =
%w[
  Array#each Array#map Array#any? Array#all? Array#index Array#keep_if
  Array#delete_if
  Enumerable#each_entry Enumerable#map Enumerable#any? Enumerable#all?
  Enumerable#select Enumerable#reject
  Set#each
].freeze
OVERRIDES =
[
  override('Array#select', 'self'),
  override('Array#reject', 'self'),
  override('Array#keep_if', 'self'),
  override('Array#delete_if', 'self'),

  override('Class#new', 'self'),
  override('Class.new', 'Class<Object>'),
  override('Class#allocate', 'self'),
  override('Class.allocate', 'Class<Object>'),

  override('Enumerable#select', 'self'),

  override('Object#!', 'Boolean'),
  override('Object#clone', 'self'),
  override('Object#dup', 'self'),
  override('Object#freeze', 'self'),
  override('Object#taint', 'self'),
  override('Object#untaint', 'self'),
  override('Object#tap', 'self'),

  override('String#freeze', 'self'),
  override('String#split', 'Array<String>'),
  override('String#lines', 'Array<String>')
]