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

importing constants from another module and using inside array results into zero or negative #20311

Closed
visrut7 opened this issue Dec 30, 2023 · 0 comments · Fixed by #20458
Closed
Assignees
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@visrut7
Copy link

visrut7 commented Dec 30, 2023

Describe the bug

I have one constants module created in src/constants/constants.v.
I am using one of the width constants to create a 2d f64 array, but gives me an error.

image

Reproduction Steps

This is my directory structure.

.
├── README.md
├── src
│   ├── constants
│   │   └── constants.v
│   └── main.v
└── v.mod

2 directories, 4 files
// src/constants/constants.v
module constants

pub const width = 20
// src/main.v
module main

import constants
const width = constants.width

fn main() {
	println(width) // 20
	mut inputs := [width][width]f64{}
}

Expected Behavior

It should compile the code without any errors.

Current Behavior

It is giving me an error that width is negative or zero but it isn't.

Possible Solution

No response

Additional Information/Context

No response

V version

0.4.3

Environment details (OS name and version, etc.)

V full version: V 0.4.3 7fc3159.053d2be
OS: linux, Ubuntu 22.04.3 LTS
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz

Git version: git version 2.34.1
Git vroot status: 053d2be
.git/config present: true

CC version: cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
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.

@visrut7 visrut7 added the Bug This tag is applied to issues which reports bugs. label Dec 30, 2023
@visrut7 visrut7 changed the title importing constants from another module and using inside arrar importing constants from another module and using inside array results into zero or negative Dec 30, 2023
@shove70 shove70 self-assigned this Jan 9, 2024
shove70 added a commit to shove70/v that referenced this issue Jan 10, 2024
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
2 participants