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

if should make local variable scope #388

Closed
yhara opened this issue Aug 28, 2022 · 7 comments
Closed

if should make local variable scope #388

yhara opened this issue Aug 28, 2022 · 7 comments

Comments

@yhara
Copy link
Collaborator

yhara commented Aug 28, 2022

Given

let a = true
if a                                                                             
  let x = 1
end                                                                              

p x

Expected

Compile error

Actual

Prints 1.

(EXC_BAD_ACCESS if a = false)

Implementation

@yhara yhara added bug design About language design labels Aug 28, 2022
@yhara
Copy link
Collaborator Author

yhara commented Aug 28, 2022

I'm considering introducing let keyword like Rust.

@yhara yhara changed the title Local variable in one-sided if leaks outside if should make local variable scope Dec 13, 2022
@yhara yhara added good first issue module:hir and removed design About language design labels Dec 15, 2022
@EruEri
Copy link
Contributor

EruEri commented Apr 14, 2023

Hi @yhara
I can try to fix this issue ?

@yhara
Copy link
Collaborator Author

yhara commented Apr 14, 2023

@EruEri Yes, please!
@AI-Mozi Please let us know if you have something more to share after the last commit in #447.

@EruEri
Copy link
Contributor

EruEri commented Apr 14, 2023

I have something that seems to work.
Can I create the PR ? I also have some questions on whevener or not the IfCtx shound have contain lvars or not

@yhara
Copy link
Collaborator Author

yhara commented Apr 14, 2023

Oh please make a new PR then.
IfCtx should have lvars, like ToplevelCtx/ClassCtx/MethodCtx, etc. does.

@moozzi
Copy link
Contributor

moozzi commented Apr 14, 2023

Hey!
I got stuck in a certain place, I don't even remember where 😅
@EruEri go ahead, I hope it goes better for you:)

@yhara
Copy link
Collaborator Author

yhara commented Jun 1, 2023

fixed by #474.

@yhara yhara closed this as completed Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants