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

C error when importing local submodule without v.mod file #19782

Open
lv37 opened this issue Nov 6, 2023 · 6 comments
Open

C error when importing local submodule without v.mod file #19782

lv37 opened this issue Nov 6, 2023 · 6 comments
Labels
Bug This tag is applied to issues which reports bugs. Module Lookup Problem Bugs/feature requests, that are related to looking up modules/mismatches in module names/paths.

Comments

@lv37
Copy link
Contributor

lv37 commented Nov 6, 2023

Describe the bug

Trying to compile

module main

import abc.def

fn main() {}

gives

/tmp/v_1002/main.15167110308330651613.tmp.c:672: error: ';' expected (got "MessageError")

Reproduction Steps

.
└── src
    ├── abc
    │   └── def
    │       └── def.v
    └── main.v

main.v

module main

import abc.def

fn main() {}

def.v

module def

compile with v ./src

Expected Behavior

compile

Current Behavior

/tmp/v_1002/main.15167110308330651613.tmp.c:672: error: ';' expected (got "MessageError")

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.2 140c838

Environment details (OS name and version, etc.)

V full version: V 0.4.2 4bc9a8f.140c838
OS: linux, Linux version 6.5.9-200.fc38.x86_64 (mockbuild@1cc7d6d790524511abd343182a21832a) (gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4), GNU ld version 2.39-15.fc38) #1 SMP PREEMPT_DYNAMIC Wed Oct 25 20:40:49 UTC 2023
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i5-4310U CPU @ 2.00GHz

getwd: /home/user/Projects/v-testing/webview
vexe: /home/user/.local/lib/v/v
vexe mtime: 2023-11-06 10:34:17

vroot: OK, value: /home/user/.local/lib/v
VMODULES: OK, value: /home/user/.vmodules
VTMP: OK, value: /tmp/v_1002

Git version: git version 2.41.0
Git vroot status: weekly.2023.44-63-g140c838f
.git/config present: true

CC version: cc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4)
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@lv37 lv37 added the Bug This tag is applied to issues which reports bugs. label Nov 6, 2023
@ArtemkaKun ArtemkaKun added the Module Lookup Problem Bugs/feature requests, that are related to looking up modules/mismatches in module names/paths. label Nov 6, 2023
@JalonSolov
Copy link
Contributor

JalonSolov commented Nov 6, 2023

V should definitely give a better error, but...

You need a v.mod file at the root of your project. V uses this file to "anchor" local module searches.

After I added that file, the output is:

$ v .
src/main.v:3:8: warning: module 'def (src.abc.def)' is imported but never used
    1 | module main
    2 | 
    3 | import abc.def
      |        ~~~~~~~
    4 | 
    5 | fn main() {}
$
.
├── src
│   ├── abc
│   │   └── def
│   │       └── def.v
│   └── main.v
└── v.mod

@lv37 lv37 changed the title C error when importing submodule C error when importing submodule without v.mod file Nov 6, 2023
@lv37 lv37 changed the title C error when importing submodule without v.mod file C error when importing local submodule without v.mod file Nov 6, 2023
@Delta456
Copy link
Member

I am not getting a C error.

image

@lv37
Copy link
Contributor Author

lv37 commented Nov 10, 2023

I am not getting a C error.

I still get it on the latest V version
image

@shove70
Copy link
Contributor

shove70 commented Nov 10, 2023

I am not getting a C error too.

image

@lv37
Copy link
Contributor Author

lv37 commented Nov 10, 2023

Compiling with v . doesn't give a C error but with v ./src it does

@Delta456
Copy link
Member

Compiling with v . doesn't give a C error but with v ./src it does

I can reproduce this on my side. Working on it.

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. Module Lookup Problem Bugs/feature requests, that are related to looking up modules/mismatches in module names/paths.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants