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

Fix unbound variable bug #134

Merged
merged 2 commits into from Sep 14, 2017

Conversation

Projects
None yet
2 participants
@Gabriel439
Copy link
Collaborator

commented Sep 13, 2017

Related to #10

When type-checking the following expression:

let Day : Type = Natural in λ(x : Day)  x

... Dhall had a bug where it would add Day : Type to the context when
inferring the type of λ(a : Day) → x (which is ∀(x : Day) → Day), but Day
was missing from the context when inferring the kind of ∀(x : Day) → Day,
leading to an unbound variable error

This change fixes the bug and adds a regression test to prevent the bug from
recurring

Fix unbound variable bug
Related to #10

When type-checking the following expression:

```haskell
let Day : Type = Natural in λ(x : Day) → x
```

... Dhall had a bug where it would add `Day : Type` to the context when
inferring the type of `λ(a : Day) → x` (which is `∀(x : Day) → Day`), but `Day`
was missing from the context when inferring the kind of `∀(x : Day) → Day`,
leading to an unbound variable error

This change fixes the bug and adds a regression test to prevent the bug from
recurring
--
-- This bug was originally reported in issue #10
_ <- Util.code "let Day : Type = Natural in λ(x : Day) → x"
return ()

This comment has been minimized.

Copy link
@bosu

bosu Sep 13, 2017

Collaborator

There is a parenthesis missing here (from line 89). This is the cause for Travis build check.

+1 on the fix itself, of course.

@Gabriel439

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 13, 2017

Whoops! You can tell I was in a hurry and couldn't run tests locally this morning :)

@bosu bosu merged commit 6bbff51 into master Sep 14, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.