Skip to content

Language Server Crashes on double imports #23

@blacktemplar

Description

@blacktemplar

If you import twice the same name in a file the whole language server crashes.

To reproduce this I created a totally empty project and created a file with only those two lines:

from nat import Nat
from nat import Nat

As soon as I save it I get a popup that the language server crashed and won't get restarted. This are the logs:

[22:49:32.156] updating /home/bene/git/private/random-stuff/acorn_tutorial/hello.ac with 40 bytes
The application panicked (crashed).
Message:  typename Nat already bound
Location: src/binding_map.rs:543

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                              ⋮ 7 frames hidden ⋮                               
 8: acorn::binding_map::BindingMap::insert_type_name::hc80660339c695965
    at <unknown source file>
 9: acorn::binding_map::BindingMap::add_type_alias::hfcbdee855d355f6a
    at <unknown source file>
10: acorn::binding_map::BindingMap::import_name::he414952a935e8e61
    at <unknown source file>
11: acorn::environment::add_statement::<impl acorn::environment::Environment>::add_statement::he373a9c7686cf0db
    at <unknown source file>
12: acorn::environment::add_statement::<impl acorn::environment::Environment>::add_tokens::h8319647ed56997e7
    at <unknown source file>
13: acorn::project::Project::load_module::h617c77cdae284d0a
    at <unknown source file>
14: acorn::project::Project::add_target_by_descriptor::h0ece40ddf091caec
    at <unknown source file>
15: acorn::project::Project::update_file::h9f3a430c733529d0
    at <unknown source file>
16: <acorn::server::AcornLanguageServer as tower_lsp::LanguageServer>::did_save::{{closure}}::h70e2170aa04343e4
    at <unknown source file>
                              ⋮ 12 frames hidden ⋮                              
29: acorn::main::{{closure}}::h81ed5f4ca863cfda
    at <unknown source file>
30: acorn::main::h032e1beba8c0503b
    at <unknown source file>
                              ⋮ 7 frames hidden ⋮                               
[Error - 22:49:32] Server process exited with code 101.
[Error - 22:49:32] Connection to server got closed. Server will not be restarted.

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