Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Fail with parametric type #17

Closed
iblislin opened this issue Dec 3, 2017 · 4 comments
Closed

Fail with parametric type #17

iblislin opened this issue Dec 3, 2017 · 4 comments
Labels

Comments

@iblislin
Copy link

iblislin commented Dec 3, 2017

julia> struct B{T} end

julia> (::B)() = 42

julia> @enter B{Int}()()
ERROR: type UnionAll has no field name
Stacktrace:
 [1] maybe_step_through_wrapper!(::Array{ASTInterpreter2.JuliaStackFrame,1}) at /home/iblis/.julia/v0.6/ASTInterpreter2/src/ASTInterpreter2.jl:422
@jamii
Copy link

jamii commented Jan 27, 2018

@iblis17

I'm not sure what the intended behavior is here, but a temporary workaround is to change the line to:

parameter = Base.unwrap_unionall(stack[1].meth.sig).parameters[1]
is_kw = (:name in fieldnames(parameter)) && startswith(String(parameter.name.name), "#kw")

That at least lets the debugger continue, and it doesn't seem to have any other problems with this kind of code.

@staticfloat
Copy link

Just a note that this still happens and causes problems in Flux with BatchNorm, e.g.:

using Flux, ASTInterpreter2
x = randn(10, 10, 4, 1)
BN = BatchNorm(4)

Trying to @enter BN(x) gives:

julia> @enter BN(x)
ERROR: type UnionAll has no field name
Stacktrace:
 [1] getproperty(::Type, ::Symbol) at ./sysimg.jl:15
 [2] maybe_step_through_wrapper!(::Array{ASTInterpreter2.JuliaStackFrame,1}) at /home/staticfloat/.julia/dev/ASTInterpreter2/src/ASTInterpreter2.jl:392
 [3] top-level scope at /home/staticfloat/.julia/dev/ASTInterpreter2/src/ASTInterpreter2.jl:465

staticfloat added a commit to staticfloat/ASTInterpreter2.jl that referenced this issue Jan 18, 2019
@KristofferC
Copy link
Member

Still happens with #37

@timholy
Copy link
Member

timholy commented Jan 28, 2019

Fixed by #40

@timholy timholy closed this as completed Jan 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants