In a rails app using sorbet, when you have a method that expects an instance of a type, say Foo
. And you need to initialize an instance of Foo
in an initializer for the app that persists in memory between requests. And then you make any change to the source code of Foo
or any file that Foo
uses. Then sorbet believes that this instance is no longer an instance of Foo
, and you need to restart your app in order for it to stop erroring.
This seems like a rare case, but in our app, we use a bit of dependency injection, and it's a large team. So sorbet is making us restart our app almost every time we do a git update, and many, many times throughout the day as we write code. We have a large app which takes a while to restart, and it's quite frustrating to have to do this.
Any ideas on how to fix this? If helpful, I could make a sample rails app to demonstrate this behavior.
question from:
https://stackoverflow.com/questions/65941290/sorbet-fails-when-using-creating-an-instance-of-an-autoloaded-class-in-rails-ini 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…