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

Type issue with setfield #22278

Closed
xqrongm opened this issue Jun 7, 2017 · 1 comment
Closed

Type issue with setfield #22278

xqrongm opened this issue Jun 7, 2017 · 1 comment

Comments

@xqrongm
Copy link

xqrongm commented Jun 7, 2017

julia> versioninfo()
Julia Version 0.5.2
Commit f4c6c9d (2017-05-06 16:34 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, haswell)


julia> type T1
field1::Array{AbstractFloat,2}
end

julia> t1i1 = T1([0. 0.])
T1(AbstractFloat[0.0 0.0])

julia> setfield!(t1i1, :field1, [1. 1.])
ERROR: TypeError: setfield!: expected Array{AbstractFloat,2}, got Array{Float64,2}

julia> t1i1.field1 = [1. 1.]
1×2 Array{Float64,2}:
 1.0  1.0
@yuyichao
Copy link
Contributor

yuyichao commented Jun 7, 2017

Dup of #16195

@yuyichao yuyichao closed this as completed Jun 7, 2017
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

No branches or pull requests

2 participants