moduleAprependModule.new# remove this line and you'd get FrozenError as expecteddeffoo;endfreezeremove_method:foo# remove works even though module is frozen!pinstance_methods(false)# => []end
Old bug, reproduces in 2.7 through 3.1 and on master. Found while investigating #19164.
Module#remove_method: Check frozen on the right object
Previously, the frozen check happened on RCLASS_ORIGIN(self), which
can return an iclass. The frozen check is supposed to respond to objects
that users can call methods on while iclasses are hidden from users.
Other mutation methods like Module#{define_method,alias_method,public}
don't do this. Check frozen status on the module itself.