Skip to content

generated function body is not pure when using dot notation #21094

@gasagna

Description

@gasagna

I have a generated function in which I rely on Julia's new dot notation for "vectorised" operations on arrays. This results in an error shown below. The minimal working example is

versioninfo()

@generated function foo(out, x)
    quote
        out .= x .+ x
    end
end

foo([0.0], [1.0])

The output is

Julia Version 0.6.0-pre.alpha.146
Commit c399558* (2017-03-15 15:20 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin15.6.0)
  CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)
ERROR: LoadError: generated function body is not pure. this likely means it contains a closure or comprehension.
Stacktrace:
 [1] include_from_node1(::String) at ./loading.jl:539
 [2] include(::String) at ./sysimg.jl:14
 [3] process_options(::Base.JLOptions) at ./client.jl:305
 [4] _start() at ./client.jl:371
while loading /Users/davide/Codes/IMEXRK.jl/src/deleteme.jl, in expression starting on line 10
[Finished in 2.1s with exit code 1]
[cmd: ['/Users/davide/Software/julia-0.6/usr/bin/julia', '/Users/davide/Codes/IMEXRK.jl/src/deleteme.jl']]
[dir: /Users/davide/Codes/IMEXRK.jl/src]
[path: /usr/bin:/bin:/usr/sbin:/sbin]

The only reference I could find similar to what I get is #19299. This issue seems different to me tough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    broadcastApplying a function over a collection

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions