@@ -27,6 +27,13 @@ struct ∂☆new{N}; end
2727function ∂☆nomethd (@nospecialize (args))
2828 throw (MethodError (primal (args[1 ]), map (primal, Base. tail (args))))
2929end
30+ function ∂☆builtin ((f_bundle, args... ))
31+ f = primal (f_bundle)
32+ argtypes = Any[Core. Typeof (primal (arg)) for arg in args]
33+ tt = Base. signature_type (f, argtypes)
34+ sig = Base. sprint (Base. show_tuple_as_call, Symbol (" " ), tt)
35+ throw (DomainError (f, " No `ChainRulesCore.frule` found for the built-in function `$sig `" ))
36+ end
3037
3138function perform_fwd_transform (world:: UInt , source:: LineNumberNode ,
3239 @nospecialize (ff:: Type{∂☆recurse{N}} ), @nospecialize (args)) where {N}
@@ -36,6 +43,11 @@ function perform_fwd_transform(world::UInt, source::LineNumberNode,
3643 end
3744
3845 sig = Tuple{map (π, args)... }
46+ if sig. parameters[1 ] <: Core.Builtin
47+ return generate_lambda_ex (world, source,
48+ Core. svec (:ff , :args ), Core. svec (), :(∂☆builtin (args)))
49+ end
50+
3951 mthds = Base. _methods_by_ftype (sig, - 1 , world)
4052 if mthds === nothing || length (mthds) != 1
4153 # Core.println("[perform_fwd_transform] ", sig, " => ", mthds)
0 commit comments