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

@pierrec pierrec commented May 17, 2026

Copy link
Copy Markdown
Contributor

Fix #57

@nalgeon

nalgeon commented May 17, 2026

Copy link
Copy Markdown
Collaborator

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

pierrec commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

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

@nalgeon

nalgeon commented May 18, 2026

Copy link
Copy Markdown
Collaborator

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