Project

General

Profile

Actions

Bug #21440

closed

Cannot create instances of frozen Data subclasses

Added by jeremyevans0 (Jeremy Evans) 1 day ago. Updated 1 day ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:122523]

Description

This fails since Data was added in Ruby 3.2:

Class.new(Data.define(:a)).freeze.new
# can't modify frozen #<Class:#<Class:0x000079cf41253160>>: #<Class:0x000079cf41253160> (FrozenError)

Note that the error occurs even before the ArgumentError due to the missing argument to new.

This doesn't happen on classes created with Data.define (only subclasses of those classes):

Data.define(:a).freeze.new
# missing keyword: :a (ArgumentError)
Actions

Also available in: Atom PDF

Like0
Like0Like0