Skip to content

A module import is not recognized if imported in two different modules under two different names #2118

@betonowy

Description

@betonowy

Zig Version

0.14.0-dev.2563+af5e73172

ZLS Version

0.14.0-dev.304+b401aab

Client / Code Editor / Extensions

VSCode with Zig Language extension

Steps to Reproduce and Observed Behavior

Here is an archive with minimal repro: test.zip

What I observed is if imports look like this:

  • mod_b imports mod_a as mod_a_import_mod_b - works
  • main imports mod_a as mod_a_import_main - doesn't work
  • main imports mod_b as mod_b_import_main - works

A minimal change in both build.zig and src/*.zig files that will make this example work is this:

  • mod_b imports mod_a as mod_a_import_main - works
  • main imports mod_a as mod_a_import_main - now it works
  • main imports mod_b as mod_b_import_main - works

So it looks as if zls doesn't cover case when module is imported in two different modules under different names.

Could possibly be related to #2117, but I wasn't sure.

Expected Behavior

Module import is recognized by zls. It was working previously (I don't have an exact version anymore, but it was when 0.14.0-dev.2457+82f35c518 was the newest version of zig master/roughly 1 month ago).

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions