Skip to content
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

Fix #368 #374

Merged
merged 2 commits into from
Oct 15, 2019
Merged

Fix #368 #374

merged 2 commits into from
Oct 15, 2019

Conversation

MikeInnes
Copy link
Member

The rough story here is that when a type like Complex{<:Real} gets written down in Julia code, it gets constructed dynamically by:

tv = Core.TypeVar(:s, Real)
body = Core.apply_type(Complex, tv)
Core.UnionAll(tv, body)

body is an intermediate state Complex{s<:Real} (notice no where s); it looks like a type but it isn't actually valid. However, generated functions, Core.Typeof etc still treat it as if it were a regular type, so it ends up inside the Pullback type, and this eventually breaks down.

julia> Core.Typeof(body)
Type{Complex{s<:Real}}

julia> Zygote.Pullback{Tuple{Core.Typeof(body)}}
Error showing value of type UnionAll:
ERROR: UndefVarError: S not defined

I'm not sure there's anything we can do about this in general; just @nograding some type functions is enough for now.

@MikeInnes MikeInnes merged commit 965ee15 into master Oct 15, 2019
@CarloLucibello CarloLucibello deleted the typevar-fix branch June 22, 2020 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant