Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear Error on Importing Submodule From Aliased Module #9973

Closed
Cons-Cat opened this issue May 2, 2021 · 1 comment · Fixed by #21156
Closed

Unclear Error on Importing Submodule From Aliased Module #9973

Cons-Cat opened this issue May 2, 2021 · 1 comment · Fixed by #21156
Assignees
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@Cons-Cat
Copy link
Contributor

Cons-Cat commented May 2, 2021

V version: V 0.2.2 60bc280.fb685ee
OS: Windows 10

What did you do?
cat temp.v

import term as te
import te.ui

fn main() {}

What did you expect to see?
Either this being allowed, or V telling me not to import modules from their aliased name.
Imho, the latter might be better aligned with V's goals.

What did you see instead?

temp.v:2:1: builder error: cannot import module "te.ui" (not found)
    1 | import term as te
    2 | import te.ui
      | ~~~~~~~~~~~~
    3 |
    4 | fn main() {}
@Cons-Cat Cons-Cat added the Bug This tag is applied to issues which reports bugs. label May 2, 2021
@ttytm
Copy link
Member

ttytm commented Apr 1, 2024

It should work. And it does. Both are separate imports, the alias is not related to the second import.

foo
├── te
│   └── ui
│       └── ui.v
├── main.v
└── v.mod
// te/ui/ui.v
module ui

pub const used = true
// main.v
import term as te
import te.ui

fn main() {
	println(ui.used)
}
v run. .
true

But the import term should still be recognized as unused - that should be fixed here #21156

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants