Class: RBI::ConflictTree

Inherits:
Tree show all
Extended by:
T::Sig
Defined in:
lib/rbi/rewriters/merge_trees.rb

Overview

A tree showing incompatibles nodes

Is rendered as a merge conflict between ‘left` and` right`: ~~~rb class Foo

<<<<<<< left
def m1; end
def m2(a); end
=======
def m1(a); end
def m2; end
>>>>>>> right

end ~~~

Instance Attribute Summary collapse

Attributes inherited from Tree

#nodes

Attributes inherited from NodeWithComments

#comments

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

Methods inherited from Tree

#<<, #add_sig_templates!, #annotate!, #deannotate!, #empty?, #filter_versions!, #flatten_singleton_methods!, #flatten_visibilities!, #group_nodes!, #index, #merge, #nest_non_public_members!, #nest_singleton_methods!, #nest_top_level_members!, #replace_attributes_with_methods!, #sort_nodes!

Methods inherited from NodeWithComments

#annotations, #merge_with, #version_requirements

Methods inherited from Node

#compatible_with?, #detach, #merge_with, #parent_conflict_tree, #parent_scope, #print, #rbs_print, #rbs_string, #replace, #satisfies_version?, #string

Constructor Details

#initialize(left_name: "left", right_name: "right") ⇒ ConflictTree

Returns a new instance of ConflictTree.



593
594
595
596
597
598
599
600
601
# File 'lib/rbi/rewriters/merge_trees.rb', line 593

def initialize(left_name: "left", right_name: "right")
  super()
  @left_name = left_name
  @right_name = right_name
  @left = T.let(Tree.new, Tree)
  @left.parent_tree = self
  @right = T.let(Tree.new, Tree)
  @right.parent_tree = self
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



587
588
589
# File 'lib/rbi/rewriters/merge_trees.rb', line 587

def left
  @left
end

#left_nameObject (readonly)

Returns the value of attribute left_name.



590
591
592
# File 'lib/rbi/rewriters/merge_trees.rb', line 590

def left_name
  @left_name
end

#rightObject (readonly)

Returns the value of attribute right.



587
588
589
# File 'lib/rbi/rewriters/merge_trees.rb', line 587

def right
  @right
end

#right_nameObject (readonly)

Returns the value of attribute right_name.



590
591
592
# File 'lib/rbi/rewriters/merge_trees.rb', line 590

def right_name
  @right_name
end