I've written a local refactoring [IDE] Refactoring to change function bodies to "fatalError()". by huonw · Pull Request #15916 · apple/swift · GitHub that's designed to be helpful for those developing the compiler, and is unlikely to be very useful for anyone not doing this (there's not usually a lot of reason to replace a function body with
fatalError() other than trying to narrow down a bug).
Is there a way we can get this landed without adding a "weird" option to the general Xcode, and without having to build a custom compiler/toolchain? I'm thinking it would be perfect if the development snapshots on swift.org could include it, but the released ones did not. Thoughts?
Thinking more about this, other Swift users may also want this refactoring for overriding-only functions. We may not need to disable it in Xcode.
Okay, sounds good! I've merged it, and if it's too weird/annoying/confusing we can revert.
Hey Huon, this seems not generally useful and I'm concerned about having it surfaced for all Xcode users.
But I also I don't want you to miss this if you find it useful. Ideally we could have 'internal' refactoring actions plugged in but there is no such mechanism currently.
How about only enabling this refactoring action if an environment variable is set ? Something like 'SWIFT_ENABLE_INTERNAL_REFACTORING_ACTIONS' or similar. If the env var is set in the system you'll be able to see the refactoring action, otherwise it will be disabled.