File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,12 @@ signature(@nospecialize other) = signature!([], other)
120
120
function argtype (expr:: Expr )
121
121
isexpr (expr, :(:: )) && return expr. args[end ]
122
122
isexpr (expr, :(... )) && return :(Vararg{$ (argtype (expr. args[1 ]))})
123
+ if isexpr (expr, :meta ) && length (expr. args) == 2
124
+ a1 = expr. args[1 ]
125
+ if a1 === :nospecialize || a1 === :specialize
126
+ return argtype (expr. args[2 ])
127
+ end
128
+ end
123
129
return argtype (expr. args[1 ])
124
130
end
125
131
argtype (@nospecialize other) = :Any
Original file line number Diff line number Diff line change @@ -211,6 +211,13 @@ function returntype(x::Int)::Int
211
211
x
212
212
end
213
213
214
+ # @nospecialize (issue #34122)
215
+ " `fnospecialize` for Numbers"
216
+ fnospecialize (@nospecialize (x:: Number )) = 1
217
+
218
+ " `fnospecialize` for arrays"
219
+ fnospecialize (@nospecialize (x:: AbstractArray )) = 2
220
+
214
221
end
215
222
216
223
let md = meta (DocsTest)[@var (DocsTest)]
@@ -284,6 +291,14 @@ let rt = @var(DocsTest.returntype)
284
291
@test md. order == [Tuple{Float64}, Tuple{Int}]
285
292
end
286
293
294
+ let fns = @var (DocsTest. fnospecialize)
295
+ md = meta (DocsTest)[fns]
296
+ d = md. docs[Tuple{Number}]
297
+ @test docstrings_equal (d, doc " `fnospecialize` for Numbers" )
298
+ d = md. docs[Tuple{AbstractArray}]
299
+ @test docstrings_equal (d, doc " `fnospecialize` for arrays" )
300
+ end
301
+
287
302
@test docstrings_equal (@doc (DocsTest. TA), doc " TA" )
288
303
289
304
@test docstrings_equal (@doc (DocsTest. @mac ), doc " @mac()" )
You can’t perform that action at this time.
0 commit comments