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

Variable scope with nested scopes #789

Open
Aurel300 opened this issue May 4, 2024 · 0 comments
Open

Variable scope with nested scopes #789

Aurel300 opened this issue May 4, 2024 · 0 comments

Comments

@Aurel300
Copy link
Member

Aurel300 commented May 4, 2024

(Reported by a PV student:)

method test() {
    {
        var i: Int
    }
    var i: Int
}

This causes an AST construction error for the second declaration of i, because it is seen as a duplicate. This is a little strange, and I would expect either:

  • The error to be associated with the inner i, because the outer declaration is hoisted to the beginning of the outer scope.
  • There to be no error, because when the outer i is declared, the inner i is no longer in scope.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant