class Tapioca::Commands::AbstractGem
def merge_with_exported_rbi(gem, file)
def merge_with_exported_rbi(gem, file) return file unless gem.export_rbi_files? tree = gem.exported_rbi_tree unless tree.conflicts.empty? say_error("\n\n RBIs exported by `#{gem.name}` contain conflicts and can't be used:", :yellow) tree.conflicts.each do |conflict| say_error("\n #{conflict}", :yellow) say_error(" Found at:", :yellow) say_error(" #{conflict.left.loc}", :yellow) say_error(" #{conflict.right.loc}", :yellow) end return file end file.root = RBI::Rewriters::Merge.merge_trees(file.root, tree, keep: RBI::Rewriters::Merge::Keep::LEFT) rescue RBI::ParseError => e say_error("\n\n RBIs exported by `#{gem.name}` contain errors and can't be used:", :yellow) say_error("Cause: #{e.message} (#{e.location})") end