Issue #11714 has been updated by Antonio Terceiro.

Subject changed from `include Module` affects code scope of code loaded by require statements on Ruby 2.2+ to `include Module` affects scope of code loaded by require statements on Ruby 2.2+

----------------------------------------
Bug #11714: `include Module` affects scope of code loaded by require statements on Ruby 2.2+
https://bugs.ruby-lang.org/issues/11714#change-54967

* Author: Antonio Terceiro
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0dev (2015-11-19 master 52671) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
This seems to be a regression with Ruby 2.2 and beyond, I can still reproduce this in Ruby trunk from today. Ruby 2.1 works just fine.

~~~
$ cat /tmp/test.rb 
module MyThing
  class Date < String
  end
end
include MyThing

require 'date'
$ ruby2.1 /tmp/test.rb 
$ ruby2.2 /tmp/test.rb 
/usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': superclass mismatch for class Date (TypeError)
	from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /usr/lib/ruby/2.2.0/date.rb:3:in `<top (required)>'
	from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /tmp/test.rb:7:in `<main>'
[1]$ /var/tmp/ruby-trunk/bin/ruby /tmp/test.rb
/var/tmp/ruby-trunk/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require': superclass mismatch for class Date (TypeError)
	from /var/tmp/ruby-trunk/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /var/tmp/ruby-trunk/lib/ruby/2.3.0/date.rb:3:in `<top (required)>'
	from /var/tmp/ruby-trunk/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /var/tmp/ruby-trunk/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /tmp/test.rb:7:in `<main>'
~~~




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