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

anonymous function at exact same pos and with same signature cause compilation error #10023

Closed
Gladear opened this issue May 6, 2021 · 0 comments
Assignees
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@Gladear
Copy link
Member

Gladear commented May 6, 2021

V version: V 0.2.2 0da827f.adffae4
OS: linux, Ubuntu 20.04.2 LTS (WSL 2)

What did you do?
a.v

module main

fn a() int {
        f := fn (i int) int {
                return i
        }
        return f(1)
}

b.v

module main

fn b() int {
        f := fn (i int) int {
                return i
        }
        return f(1)
}

fn main() {
        println(a())
        println(b())
}

What did you expect to see?
Successful compilation

What did you see instead?

==================
/tmp/v/test_project.7116915371345699856.tmp.c:1620: error: redefinition of 'anon_fn_int__int_47'
...
==================
(Use `v -cg` to print the entire error message)

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

If you were not working with C interop, this is a compiler bug, please report the bug using `v bug file.v`.

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

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

Details

See vlib/v/parser/fn.v

@Gladear Gladear added the Bug This tag is applied to issues which reports bugs. label May 6, 2021
@spytheman spytheman self-assigned this May 6, 2021
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