Skip to content

Commit b8adb2e

Browse files
authored
Relax type restriction in ismutationfree and isidentityfree. (#48357)
Fixes #48353.
1 parent 134f3e7 commit b8adb2e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

base/reflection.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,13 +634,14 @@ is reachable from this type (either in the type itself) or through any fields.
634634
Note that the type itself need not be immutable. For example, an empty mutable
635635
type is `ismutabletype`, but also `ismutationfree`.
636636
"""
637-
function ismutationfree(@nospecialize(t::Type))
637+
function ismutationfree(@nospecialize(t))
638638
t = unwrap_unionall(t)
639639
if isa(t, DataType)
640640
return datatype_ismutationfree(t)
641641
elseif isa(t, Union)
642642
return ismutationfree(t.a) && ismutationfree(t.b)
643643
end
644+
# TypeVar, etc.
644645
return false
645646
end
646647

@@ -652,7 +653,7 @@ datatype_isidentityfree(dt::DataType) = (@_total_meta; (dt.flags & 0x0200) == 0x
652653
Determine whether type `T` is identity free in the sense that this type or any
653654
reachable through its fields has non-content-based identity.
654655
"""
655-
function isidentityfree(@nospecialize(t::Type))
656+
function isidentityfree(@nospecialize(t))
656657
t = unwrap_unionall(t)
657658
if isa(t, DataType)
658659
return datatype_isidentityfree(t)

0 commit comments

Comments
 (0)