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

consts and enums from Nested modules are not seen on FreeBSD #19605

Closed
bakul opened this issue Oct 20, 2023 · 4 comments
Closed

consts and enums from Nested modules are not seen on FreeBSD #19605

bakul opened this issue Oct 20, 2023 · 4 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@bakul
Copy link
Contributor

bakul commented Oct 20, 2023

Describe the bug

When a module is two levels deep, its pub const and pub enum values are not seen when this module is included.

Reproduction Steps

mkdir -p foo/bar
cat > foo/bar/bar.v <<EOF
module bar

pub const xyz = 12
EOF
cat > main.v <<EOF
import foo.bar
fn main() {
  println(bar.xyz)
}
EOF
v run main.v

### Expected Behavior

It should print 12

### Current Behavior

On FreeBSD the compilation fails with

error: undefined ident: foo.bar.xyz


It works fine on Ubuntu

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### V version

V 0.4.2 b3d1b04

### Environment details (OS name and version, etc.)

FreeBSD-14.0-STABLE
> [!NOTE]
> You can vote for this issue using the 👍 reaction. More votes increase the issue's priority for developers.
>
> Take into account that only the 👍 reaction counts as a vote.
> Only reactions to the issue itself will be counted as votes, not comments.
@bakul bakul added the Bug This tag is applied to issues which reports bugs. label Oct 20, 2023
@spytheman
Copy link
Member

run touch v.mod:
image

@spytheman
Copy link
Member

The behavior is consistent with that on Linux:
image

i.e. if you have v.mod at the top of your project, module lookup works.
If you do not, module lookup fails.

@bakul
Copy link
Contributor Author

bakul commented Oct 20, 2023

I have a v.mod in the same directory! I removed it and did touch v.mod but no such luck. If it matters, v uses clang.

@bakul
Copy link
Contributor Author

bakul commented Oct 20, 2023

The problem turned out to be an old v.mod in the parent directory. [Just documenting this in case someone else runs into it]

The root cause is "pesky" module lookup (as per @spytheman!)

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

No branches or pull requests

2 participants