patch 9.0.0085: ":write" fails after ":file name" and the ":edit"

Problem:    ":write" fails after ":file name" and the ":edit".
Solution:   Reset BF_NOTEDITED when using ":edit". (closes #10790)
diff --git a/src/testdir/test_excmd.vim b/src/testdir/test_excmd.vim
index f55e6a5..7b270ff 100644
--- a/src/testdir/test_excmd.vim
+++ b/src/testdir/test_excmd.vim
@@ -725,5 +725,21 @@
   bwipe!
 endfunc
 
+" Test :write after changing name with :file and loading it with :edit
+func Test_write_after_rename()
+  call writefile(['text'], 'Xfile')
+
+  enew
+  file Xfile
+  call assert_fails('write', 'E13: File exists (add ! to override)')
+
+  " works OK after ":edit"
+  edit
+  write
+
+  call delete('Xfile')
+  bwipe!
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab