File tree 4 files changed +13
-20
lines changed
4 files changed +13
-20
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,9 @@ This section lists changes that do not have deprecation warnings.
130
130
(since it is shorthand for ` NTuple{N,T} where T ` ). To get the old behavior of matching
131
131
any tuple, use ` NTuple{N,Any} ` ([ #18457 ] ).
132
132
133
+ * ` isimmutable(T::Type) ` now checks whether ` T ` is an immutable type,
134
+ rather than checking whether ` typeof(T) ` is an immutable type ([ #18168 ] ).
135
+
133
136
Library improvements
134
137
--------------------
135
138
@@ -210,8 +213,6 @@ Library improvements
210
213
211
214
* New ` iszero(x) ` function to quickly check whether ` x ` is zero (or is all zeros, for an array) ([ #19950 ] ).
212
215
213
- * New function ` isimmutabletype(T) ` ([ #18168 ] ).
214
-
215
216
* ` notify ` now returns a count of tasks woken up ([ #19841 ] ).
216
217
217
218
Compiler/Runtime improvements
Original file line number Diff line number Diff line change @@ -946,7 +946,6 @@ export
946
946
isbits,
947
947
isequal,
948
948
isimmutable,
949
- isimmutabletype,
950
949
isless,
951
950
ifelse,
952
951
lexless,
Original file line number Diff line number Diff line change @@ -195,25 +195,18 @@ datatype_fielddesc_type(dt::DataType) = dt.layout == C_NULL ? throw(UndefRefErro
195
195
(unsafe_load (convert (Ptr{DataTypeLayout}, dt. layout)). alignment >> 30 ) & 3
196
196
197
197
"""
198
- isimmutable(v )
198
+ isimmutable(x )
199
199
200
- Return `true` iff value `v ` is immutable. See [Immutable Composite Types](@ref)
201
- for a discussion of immutability. Note that this function works on values, so if you give it
202
- a type, it will tell you that a value of `DataType` is mutable .
200
+ Return `true` if the value `x ` is immutable; if `x` is a type, then returns
201
+ whether `x` is an immutable type. See [Immutable Composite Types](@ref)
202
+ for a discussion of immutability .
203
203
"""
204
204
isimmutable (x:: ANY ) = (@_pure_meta ; (isa (x,Tuple) || ! typeof (x). mutable))
205
+ isimmutable (t:: DataType ) = (@_pure_meta ; ! t. mutable)
206
+ isimmutable (:: Type ) = (@_pure_meta ; false )
205
207
isstructtype (t:: DataType ) = (@_pure_meta ; nfields (t) != 0 || (t. size== 0 && ! t. abstract))
206
208
isstructtype (x) = (@_pure_meta ; false )
207
209
208
- """
209
- isimmutabletype(T)
210
-
211
- Return `true` if the type `T` is immutable. See [manual](:ref:`man-immutable-composite-types`)
212
- for a discussion of immutability. See also [`isimmutable`](:func:`isimmutable`)
213
- for the corresponding function acting on values rather than types.
214
- """
215
- isimmutabletype (t:: ANY ) = (@_pure_meta ; isa (t, DataType) && ! t. mutable)
216
-
217
210
"""
218
211
isbits(T)
219
212
Original file line number Diff line number Diff line change @@ -161,10 +161,10 @@ not_const = 1
161
161
@test isimmutable ([]) == false
162
162
@test isimmutable (" abc" ) == true
163
163
@test isimmutable ((3 ,4 ,5 )) == true
164
- @test isimmutabletype (Int) == true
165
- @test isimmutabletype (Vector{Int}) == false
166
- @test isimmutabletype (String) == true
167
- @test isimmutabletype (Tuple{Int}) == true
164
+ @test isimmutable (Int) == true
165
+ @test isimmutable (Vector{Int}) == false
166
+ @test isimmutable (String) == true
167
+ @test isimmutable (Tuple{Int}) == true
168
168
169
169
170
170
# # find bindings tests
You can’t perform that action at this time.
0 commit comments