fix primal return type methoderror#2768
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #2768 +/- ##
===========================================
- Coverage 68.91% 50.87% -18.05%
===========================================
Files 58 13 -45
Lines 19861 1256 -18605
===========================================
- Hits 13688 639 -13049
+ Misses 6173 617 -5556 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This seems wrong to me, do see #2663 for the change that likely broke the behavior here. In particular: https://github.com/EnzymeAD/Enzyme.jl/pull/2663/files#diff-a5ddd0c06b3228d600577533c56e26161c6952c6b5c89b4befb5fc6b66ffce45L104-L117 |
| if mi === nothing | ||
| result = Union{} | ||
| code = Any[Expr(:call, Base.throw, :(MethodError(ft, tt))), | ||
| Core.Compiler.ReturnNode(result)] | ||
| # create an empty CodeInfo to return the result | ||
| slotnames = Core.svec(Symbol("#self#"), :ft, :tt) | ||
| ci = create_fresh_codeinfo(primal_return_type, source, world, slotnames, code) |
There was a problem hiding this comment.
No we used stub successfully here before.
|
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/src/typeutils/inference.jl b/src/typeutils/inference.jl
index d660fd13..c7259a2f 100644
--- a/src/typeutils/inference.jl
+++ b/src/typeutils/inference.jl
@@ -111,8 +111,10 @@ function primal_return_type_generator(world::UInt, source, self, @nospecialize(m
if mi === nothing
result = Union{}
- code = Any[Expr(:call, Base.throw, :(MethodError(ft, tt))),
- Core.Compiler.ReturnNode(result)]
+ code = Any[
+ Expr(:call, Base.throw, :(MethodError(ft, tt))),
+ Core.Compiler.ReturnNode(result),
+ ]
# create an empty CodeInfo to return the result
slotnames = Core.svec(Symbol("#self#"), :ft, :tt)
ci = create_fresh_codeinfo(primal_return_type, source, world, slotnames, code) |
vchuravy
left a comment
There was a problem hiding this comment.
We should still use GeneratedFunctionStub
|
The thing that doesn't make sense to me here with the old code is that you were stubbing |
|
We are writing a generator for a generated function, so we can't throw a MethodError right here and there. We want to throw a method error from the generated function.
Because that's the supported interface? |
|
Correct fix in #2771 |
mostly fixes #2733 (but hits the following error because I'm metaprogramming badly somehow)