Skip to content

Scoped variables in anonymous functions #21

@VincenzoArceri

Description

@VincenzoArceri

In commit 432526b, support for the anonymous functions has been added. Nevertheless, a bug concerning the scoped variables, when the anonymous function is invoked, is still present.
Let's consider the following function

func main() {
	a := 2
	b := func(f int) int {
			return a * f
		}(5)
}

The current scoping rules hide the variable a to the anonymous function, while it should be visible to it. Currently, when the anonymous function is invoked, any variable visible before the invocation is hidden to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions