[PATCH] D91134: [clangd] Abort rename when given the same name

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 10 06:36:59 PST 2020


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:218
+    case ReasonToReject::SameName:
+      return "new name should differ from the old name";
     }
----------------
returning an error seems to be an interesting idea, thinking more about that, it might be better than just returning an empty workspaceEdit silently without noticing user.



================
Comment at: clang-tools-extra/clangd/unittests/RenameTests.cpp:900
+  EXPECT_THAT(llvm::toString(Results.takeError()),
+              testing::HasSubstr("new name should differ"));
+
----------------
this test is for prepareRename, I think we should put it to `TEST(RenameTest, Renameable)`. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91134/new/

https://reviews.llvm.org/D91134



More information about the cfe-commits mailing list