File tree 1 file changed +4
-2
lines changed 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -232,12 +232,14 @@ macro assert(ex, msgs...)
232
232
msg = msg # pass-through
233
233
elseif ! isempty (msgs) && (isa (msg, Expr) || isa (msg, Symbol))
234
234
# message is an expression needing evaluating
235
- msg = :(Main. Base. invokelatest (Main. Base. string, $ (esc (msg))))
235
+ # N.B. To reduce the risk of invalidation caused by the complex callstack involved
236
+ # with `string`, use `inferencebarrier` here to hide this `string` from the compiler.
237
+ msg = :(Main. Base. inferencebarrier (Main. Base. string)($ (esc (msg))))
236
238
elseif isdefined (Main, :Base ) && isdefined (Main. Base, :string ) && applicable (Main. Base. string, msg)
237
239
msg = Main. Base. string (msg)
238
240
else
239
241
# string() might not be defined during bootstrap
240
- msg = :(Main. Base. invokelatest (_assert_tostring, $ (Expr (:quote ,msg))))
242
+ msg = :(Main. Base. inferencebarrier (_assert_tostring)( $ (Expr (:quote ,msg))))
241
243
end
242
244
return :($ (esc (ex)) ? $ (nothing ) : throw (AssertionError ($ msg)))
243
245
end
You can’t perform that action at this time.
0 commit comments