CARVIEW |
Select Language
HTTP/2 200
x-amz-id-2: dNlfhE6Rha0F8wHFJLfQaw/jDD6RT/EN0Psviun3PuKqmXVdizLwaaEt+r3/NgRcHH+pHLRsHuI=
x-amz-request-id: XSNHB91YYZQ6TW0A
last-modified: Thu, 15 May 2025 09:50:51 GMT
etag: "5fc06e61238ab5c0558029d0fbd69db0"
x-amz-server-side-encryption: AES256
server: AmazonS3
content-encoding: gzip
via: 1.1 varnish, 1.1 varnish
content-type: text/plain; charset=utf-8
accept-ranges: bytes
age: 0
date: Sat, 26 Jul 2025 10:20:59 GMT
x-served-by: cache-tyo11972-TYO, cache-bom-vanm7210070-BOM
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-timer: S1753525259.797698,VS0,VE342
vary: Accept-Encoding
content-length: 844
From: "yahonda (Yasuo Honda) via ruby-core"
Date: 2025-05-15T09:40:57+00:00
Subject: [ruby-core:122114] [Ruby Bug#21341] `Namespace is not a module (TypeError)` without enabling the namespace
Issue #21341 has been reported by yahonda (Yasuo Honda).
----------------------------------------
Bug #21341: `Namespace is not a module (TypeError)` without enabling the namespace
https://bugs.ruby-lang.org/issues/21341
* Author: yahonda (Yasuo Honda)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-05-15T08:25:56Z master 427ede2dde) +PRISM [x86_64-linux]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Ruby on Rails test case has the `module Namespace`.
https://github.com/rails/rails/blob/main/activemodel/test/validators/namespace/email_validator.rb#L5
```ruby
module Namespace
class EmailValidator < ::EmailValidator
end
end
```
This code fails against Ruby 3.5.0dev without enabling the namespace feature.
### Steps to reproduce
```ruby
$ ruby -ve 'module Namespace; end'
```
### Expected behavior
It should run without errors.
### Actual behavior
It raises the TypeError.
```ruby
$ ruby -ve 'module Namespace; end'
ruby 3.5.0dev (2025-05-15T08:25:56Z master 427ede2dde) +PRISM [x86_64-linux]
-e:1:in '': Namespace is not a module (TypeError)
ruby:0: previous definition of Namespace was here
```
Raising this TypeError with RUBY_NAMESPACE=1 looks expected to me.
```ruby
$ RUBY_NAMESPACE=1 ruby -ve 'module Namespace; end'
ruby 3.5.0dev (2025-05-15T08:25:56Z master 427ede2dde) +PRISM [x86_64-linux]
ruby: warning: Namespace is experimental, and the behavior may change in the future!
See doc/namespace.md for known issues, etc.
-e:1:in '': Namespace is not a module (TypeError)
ruby:0: previous definition of Namespace was here
```
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/