Issue #11687 has been reported by Kenichi Kamiya.

----------------------------------------
Bug #11687: Method visibility changers works on frozen modules
https://bugs.ruby-lang.org/issues/11687

* Author: Kenichi Kamiya
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0dev (2015-11-14 trunk 52576) [x86_64-darwin15]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Method visibility changers are working after `freeze`.
Is this an intended behavior?

[patch](https://github.com/ruby/ruby/pull/1096)

~~~
module Foo
  CONSTANT = nil
  def func; end

  freeze
end

Foo.private_constant :CONSTANT #=> RuntimeError: can't modify frozen module
Foo.__send__ :private, :func  #=> returned: Foo, expected: a RuntimeError as above
Foo.private_instance_methods #=> [:func]
~~~



-- 
https://bugs.ruby-lang.org/