-
-
Notifications
You must be signed in to change notification settings - Fork 419
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 an issue with infinite loops while typechecking some expressions #4274
Conversation
Only thing WIP I just need to find a good test for it and it could possibly serve to be cleaner. Running manually against the test cases so far seems to work correctly. |
baae452
to
89197c3
Compare
Marking as "do not merge" because the testing is WIP. |
@jasoncarr0 Can you explain someone like me who tried to look into it without success, how this fixes the subtype check recursion and for what kind of types this works? I am very curious but unfortunately unable to understand from this PR. ❤️ |
Hi @jasoncarr0, The changelog - fixed label was added to this pull request; all PRs with a changelog label need to have release notes included as part of the PR. If you haven't added release notes already, please do. Release notes are added by creating a uniquely named file in the The basic format of the release notes (using markdown) should be:
Thanks. |
@mfelsche Ultimately the main point is to avoid infinite loops by identifying when we have already started checking a given goal. This PR does that by pushing the goal into the assumptions earlier than it would be before, so we have it in place before certain recursive calls. |
7410350
to
2c602b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me assuming tests pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test should be moved to libponyc-run. We don't do "TEST_COMPILE" tests in libponyc tests anymore.
@@ -0,0 +1,14 @@ | |||
primitive Foo[T: (Unsigned & UnsignedInteger[T])] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment at the top level of this file explaining in general that this is a compile time check so the "additional cases" are covered because this is compile time, not runtime checking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in f16a0ea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er, I added the comment locally, not at the top, is that fine?
Some recursive constraints in type signatures could result in infinite loops while typechecking in cases where the typechecking should have succeeded.
This fixes those cases.
Fixes #3658
The fix works by making these cases more coinductive: pushing the assumption before typechecking equality of expressions.