Skip to content

Compiler doesn't catch type mismatch with int and time.Duration #18873

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

Open
einar-hjortdal opened this issue Jul 15, 2023 · 0 comments
Open

Compiler doesn't catch type mismatch with int and time.Duration #18873

einar-hjortdal opened this issue Jul 15, 2023 · 0 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@einar-hjortdal
Copy link
Contributor

Describe the bug

As seen in this commit, the compiler does not catch that time.Duration is assigned to an int field. Compiles without errors and causes runtime exceptions.

Expected Behavior

Compiler should raise an error with type mismatch

Current Behavior

No compiler error

Reproduction Steps

Clone https://github.com/Coachonko/sessions, checkout to 8d5c14fba843126ddaf7f6845747819d7a53057a
This problem is solved with commit f9545fbf280f06208eaee899ca4cd6f0135a2022 and diff can be seen for relevant code.

Possible Solution

No response

Additional Information/Context

No response

V version

Current V version: V 0.4.0 b06811c, timestamp: 2023-07-14 20:44:01 +0300

Environment details (OS name and version, etc.)

V full version: V 0.4.0 ee4150f.b06811c
OS: linux, Linux version 5.14.0-284.18.1.el9_2.x86_64 (mockbuild@euro.kojibuilder101) (gcc (GCC) 11.3.1 20221121 (Red Hat 11.3.1-4), GNU ld version 2.35.2-37.el9) #1 SMP PREEMPT_DYNAMIC Fri Jun 23 16:35:13 CEST 2023
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz

getwd: /home/coachonko/Documents/projects/vlang/sessions
vexe: /home/coachonko/.local/lib64/v/v
vexe mtime: 2023-07-15 12:50:56

vroot: OK, value: /home/coachonko/.local/lib64/v
VMODULES: OK, value: /home/coachonko/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.39.3
Git vroot status: weekly.2023.27-73-gb06811cb
.git/config present: true

CC version: cc (GCC) 11.3.1 20221121 (Red Hat 11.3.1-4)
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
@einar-hjortdal einar-hjortdal added the Bug This tag is applied to issues which reports bugs. label Jul 15, 2023
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

1 participant