blob: 581f2e18950aa7afbd02524a1e7787dab84382ff [file] [log] [blame]
# This test exercises an edge case of merging.
#
# Two analyzers generate overlapping fixes for this package:
# - 'rename' changes "bar" to "baz"
# - 'marker' changes "ar" to "baz"
# Historically this used to cause a conflict, but as it happens,
# the new merge algorithm splits the rename fix, since it overlaps
# the marker fix, into two subedits:
# - a deletion of "b" and
# - an edit from "ar" to "baz".
# The deletion is of course nonoverlapping, and the edit,
# by happy chance, is identical to the marker fix, so the two
# are coalesced.
#
# (This is a pretty unlikely situation, but it corresponds
# to a historical test, TestOther, that used to check for
# a conflict, and it seemed wrong to delete it without explanation.)
#
# The fixes are silently and successfully applied.
checker -rename -marker -fix -v example.com/a
stderr applied 2 fixes, updated 1 file
exit 0
-- go.mod --
module example.com
go 1.22
-- a/a.go --
package a
func f(bar int) {} //@ fix("ar", "baz")
-- want/a/a.go --
package a
func f(baz int) {} //@ fix("ar", "baz")