Skip to content

Invalid substitution of import with using #398

Description

@helgee

The formatter treats all relative imports as modules which is not always the case. See MWE below:

Input

test.jl

module Foo

const bar = 1.0

module Baz

import ..bar

end

end

Output

julia -e 'using JuliaFormatter; format("test.jl", BlueStyle())'

module Foo

const bar = 1.0

module Baz

# 😱 
using ..bar: bar

end

end

Workaround

Change input to

module Foo

const bar = 1.0

module Baz

using ..Foo: bar

end

end

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions