rf icon indicating copy to clipboard operation
rf copied to clipboard

rf: panic: type check did not complete

Open zx2c4 opened this issue 4 years ago • 1 comments

I'd like to convert my old usages of unsafe casts to use unsafe.Add. I started with the simplest of rules to begin this:

ex {
        import "unsafe";
        var p unsafe.Pointer;
        var o uintptr;
        (unsafe.Pointer)(uintptr(p) + o) -> unsafe.Add(p, o)
}

But rf becomes upset:

panic executing: 
panic: type check did not complete [recovered]
        panic: type check did not complete

goroutine 1 [running]:
main.run.func1()
        /tmp/rf/rf.go:76 +0xa5
panic({0x63e3e0, 0x6d1100})
        /usr/lib/go/src/runtime/panic.go:1038 +0x215
rsc.io/rf/refactor.(*Snapshot).typeCheck(0xc0000ea120)
        /tmp/rf/refactor/snap.go:588 +0x91c
rsc.io/rf/refactor.(*Refactor).Load(0xc0000c43c0)
        /tmp/rf/refactor/snap.go:356 +0x180a
main.run(0xc0000c43c0, {0x7ffc50738a4d, 0xc000062750})
        /tmp/rf/rf.go:101 +0x224
main.main()
        /tmp/rf/rf.go:44 +0x165

zx2c4 avatar Oct 11 '21 21:10 zx2c4

Thanks for the bug report. As a workaround, you can use

gofmt -r 'unsafe.Pointer(uintptr(p) + o) -> unsafe.Add(p, o)' -w .

to do this.

rsc avatar Oct 12 '21 11:10 rsc