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

Built-in function collision with user-defined error #19808

Closed
MCausc78 opened this issue Nov 8, 2023 · 0 comments · Fixed by #19942
Closed

Built-in function collision with user-defined error #19808

MCausc78 opened this issue Nov 8, 2023 · 0 comments · Fixed by #19942
Labels
Bug This tag is applied to issues which reports bugs. Build V build error on any OS/CPU architecture. Nicer V Errors Bugs/feature requests, related to improving V error messages. Unit: cgen Bugs/feature requests, that are related to the default C generating backend.

Comments

@MCausc78
Copy link
Contributor

MCausc78 commented Nov 8, 2023

Describe the bug

<title>

Reproduction Steps

fn main() {
    error := {0: 1, 1: 2, 2: 3}
    println(error[4] or { 42 })
}

Expected Behavior

skull.v:3:2: error: ambiguous naming to: `error`, may refer to fn `error` or variable `error`
    1 | fn main() {
    2 |     error := {0: 1, 1: 2, 2: 3}
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3 |     println(error[4] or { 42 })

Current Behavior

==================
C:/Users/mclr/AppData/Local/Temp/v_0/skull.2730659896825627182.tmp.c:6790: warning: implicit declaration of function 'tcc_backtrace'
C:/Users/mclr/AppData/Local/Temp/v_0/skull.2730659896825627182.tmp.c:12752: error: function pointer expected
...
==================
(Use `v -cg` to print the entire error message)

builder error:
==================
C error. This should never happen.

This is a compiler bug, please report it using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

Possible Solution

Don't name variable _v_error, but _vvar_error

Additional Information/Context

V version

V 0.4.2 ad935ca

Environment details (OS name and version, etc.)

V full version: V 0.4.2 140c838.ad935ca
OS: windows, Microsoft Windows 11 Pro v22000 64-bit
Processor: 12 cpus, 64bit, little endian, 

getwd: D:\Games\Proekti\V\openai
vexe: D:\Games\Proekti\V\v\v.exe
vexe mtime: 2023-11-08 12:30:02

vroot: OK, value: D:\Games\Proekti\V\v
VMODULES: OK, value: C:\Users\mclr\.vmodules
VTMP: OK, value: C:\Users\mclr\AppData\Local\Temp\v_0

Git version: git version 2.37.0.windows.1
Git vroot status: weekly.2023.44-83-gad935cad
.git/config present: true

CC version:
thirdparty/tcc status: thirdparty-windows-amd64 e90c2620

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.

@MCausc78 MCausc78 added the Bug This tag is applied to issues which reports bugs. label Nov 8, 2023
@ArtemkaKun ArtemkaKun added Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Build V build error on any OS/CPU architecture. Nicer V Errors Bugs/feature requests, related to improving V error messages. labels Nov 8, 2023
@Delta456 Delta456 assigned Delta456 and unassigned Delta456 Nov 8, 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. Build V build error on any OS/CPU architecture. Nicer V Errors Bugs/feature requests, related to improving V error messages. Unit: cgen Bugs/feature requests, that are related to the default C generating backend.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants