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 eta-expansion in evaluator #2782

Merged
merged 1 commit into from
Aug 27, 2024
Merged

Fix eta-expansion in evaluator #2782

merged 1 commit into from
Aug 27, 2024

Conversation

christiaanb
Copy link
Member

@christiaanb christiaanb commented Aug 5, 2024

For some eta-reduced 'e', we used to bogusly eta-expand to:

\x.(\y. e y) x

We now correctly expand to:

\x.\y.(e x) y

Fixes #2781

Still TODO:

  • Write a changelog entry (see changelog/README.md)
  • Check copyright notices are up to date in edited files

@leonschoorl
Copy link
Member

I can confirm that this also fixes the original non-minimized version of the problem.

@christiaanb do you still want to keep this as a draft PR?

@christiaanb
Copy link
Member Author

I'll add the test case and make it ready for review.

fullMeshSwCcTest sysClk = spiDone
where
(spiDone
, ugnsStable -- :: Vec 1 (Signal System Bool) -- this signature causes "Evaluator.instantiate: Not a tylambda: Lambda"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better remove this comment to avoid confusion.

Originally the bug was triggered by the addition of this type signature, hence the comment.
But this curious property was lost somewhere during minimization of the test case, in the current form it always triggered the bug.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove the comment.


go _ supply (Left tv) = (supply, Right tv)
go names supply (Right ty) =
let ((supply1, _), n) = mkUniqSystemId (supply, names) ("x", ty)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe to just ignore the updated InscopeSet here?

Copy link
Member Author

@christiaanb christiaanb Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's not. The new binders should not shadow each other. I'll fix this.

For some eta-reduced 'e', we used to bogusly eta-expand to:

\x.(\y. e y) x

We now correctly expand to:

\x.\y.(e x) y

Fixes #2781
@christiaanb christiaanb merged commit f946617 into master Aug 27, 2024
13 checks passed
@christiaanb christiaanb deleted the fix2781 branch August 27, 2024 09:20
mergify bot pushed a commit that referenced this pull request Aug 27, 2024
For some eta-reduced 'e', we used to bogusly eta-expand to:

\x.(\y. e y) x

We now correctly expand to:

\x.\y.(e x) y

Fixes #2781

(cherry picked from commit f946617)
christiaanb added a commit that referenced this pull request Aug 27, 2024
For some eta-reduced 'e', we used to bogusly eta-expand to:

\x.(\y. e y) x

We now correctly expand to:

\x.\y.(e x) y

Fixes #2781

(cherry picked from commit f946617)

Co-authored-by: Christiaan Baaij <christiaan.baaij@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluator.instantiate: Not a tylambda: Lambda ...
2 participants