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

typecheck permitting variables not in (hygenic) scope #941

Closed
waalge opened this issue May 14, 2024 · 1 comment · Fixed by #944
Closed

typecheck permitting variables not in (hygenic) scope #941

waalge opened this issue May 14, 2024 · 1 comment · Fixed by #944
Labels
bug Something isn't working typechecking Types and inference

Comments

@waalge
Copy link
Contributor

waalge commented May 14, 2024

What Git revision are you using?

v1.0.26-alpha+6d7b851

What operating system are you using, and which version?

nixos

Describe what the problem is?

pub fn a(x: Int) {
  b(x)
}

fn b(y: Int) {
  trace cbor.diagnostic((x, y))
  x + y
}

This type checks and causes a build to panic.

crates/uplc/src/optimize/shrinker.rs:960:67

       called `Result::unwrap()` on an `Err` value: FreeUnique(Name { text: "x", unique: Unique(6) })

Found when the LSP invited me to use a variable not in the scope of the function, but is where function is invoked, which confused me.

What should be the expected behavior?

Typecheck says this is illegal

@KtorZ KtorZ added bug Something isn't working typechecking Types and inference labels May 14, 2024
@KtorZ
Copy link
Member

KtorZ commented May 14, 2024

Hmm. Looks like we've introduced a regression with the scope in #922. I know the problem. Good thing we haven't released that version yet 😶 ...

KtorZ added a commit that referenced this issue May 15, 2024
  Fixes #941.

  However, this currently breaks the stdlib somehow with some FreeUnique on the shrinker step of the optimizer.
@KtorZ KtorZ closed this as completed in eadf709 May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working typechecking Types and inference
Projects
Status: 🚀 Released
Development

Successfully merging a pull request may close this issue.

2 participants