-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Precompilation affects function call in @generated function #19942
Comments
This appears to be documented.
|
Ah, I was only looking at # package infrastructure
transform{T}(::Type{T}) = T
function transform_arguments(argtyp)
return transform(argtyp)
end
@generated function entrypoint(args)
transform_arguments(...)
end
# somewhere else (possibly user code)
type Something end
type SomethingElse end
transform(::Type{Something}) = SomethingElse I guess this falls under the same restriction? |
Yes. As you can see, generated function are now prohibited from masquerading as |
Does |
Officially undefined (in that it has been observed the behavior in this case is fairly unpredictable) |
Unfortunately, this restriction also makes it hairy to write an extensible compiler for a DSL implemented with parametric types. I can't define new types and say |
Running into some #17057 complexity on latest master, where depending on the position in the source file / precompilation is on or off, a generated function selects a different method to call.
Foo/src/Foo.jl
:Bar/src/Bar.jl
:test.jl
:If I run this code as-is, I get the expected (to me) behaviour of the
Original
type getting transformed toTransformed
:However, if I disable precompilation, it matches the first definition of
transform
:This is further exemplified by removing the first
transform
definition:This error does not show if I run with precompilation enabled. Furthermore, if I move the
@generated function test
below the additional definition oftransform
the issue disappears.Also, on 0.5 everything works 'as expected' (ie.
Transformed
is returned in all cases, without errors)The text was updated successfully, but these errors were encountered: