Skip to content

Fix #57 (LHS var name shadow of RHS expr fails to compile)#58

Closed
pierrec wants to merge 1 commit into
solod-dev:mainfrom
pierrec:fix-shadow-in-initializer
Closed

Fix #57 (LHS var name shadow of RHS expr fails to compile)#58
pierrec wants to merge 1 commit into
solod-dev:mainfrom
pierrec:fix-shadow-in-initializer

Conversation

@pierrec
Copy link
Copy Markdown
Contributor

@pierrec pierrec commented May 17, 2026

Fix #57

@nalgeon
Copy link
Copy Markdown
Collaborator

nalgeon commented May 17, 2026

Honestly, I don't like this change. It makes the transpiler logic more complicated for a use case that, in my opinion, shouldn't be encouraged in the first place — shadowing the variable in the assignment like this:

p := person{age: 42}
{
	p := p.age + 1
}

@pierrec
Copy link
Copy Markdown
Contributor Author

pierrec commented May 17, 2026

Fair enough. Maybe then provide a So compiler error instead?

@nalgeon
Copy link
Copy Markdown
Collaborator

nalgeon commented May 18, 2026

Great idea! Added self-shadowing check in 0bc79c6

@nalgeon nalgeon closed this May 18, 2026
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

Successfully merging this pull request may close these issues.

LHS var name shadow of RHS expr fails to compile

2 participants