Skip to content

Crashes during macro expansion #8707

@MikeInnes

Description

@MikeInnes

I'm working on a macro, here, which seems to cause problems for the compiler.

This expands and evaluates just fine:

julia> @objc [[[NSString alloc] initWithUTF8String:"foo"] UTF8String] |> bytestring
"foo"

But this hangs at the REPL:

julia> :(@objc begin
           s = [NSString alloc]
           [s initWithUTF8String:"foo"]
       end) |> macroexpand
fatal: error thrown and no exception handler available.
Base.MethodError(f=getindex, args=(<?::quote Expr(:macrocall, :@objc, Expr(:block, Expr(:line, 2, :/Users/mike/Library/Application Support/LightTable/plugins/Julia-LT/jl/init.jl)::Any, :s = Expr(:hcat, :NSString, :alloc)::Any, # line 3, Expr(:hcat, :s, Expr(::, :initWithUTF8String, "foo")::Any)::Any)::Any)::Any end>, 1))

Julia seems to produce this error + occasional type errors and segfaults.

The weirdest part is that all is fine if you get rid of the call to esc here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions