Skip to content

Ban classes that incompatibly refine type params #14820

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

Closed
wants to merge 1 commit into from

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Mar 31, 2022

Where "incompatibly" means outside of sub/supertypes. Intending to resolve #11834. Actually, it's resolving what the "Towards Improved GADT Reasoning in Scala" paper calls "an Old Paradox". (cc @LPTK and @Blaisorblade).

But I had to change the check because invariant refinement only was too strict for some legitimate cases, from the various strawman collection ideas in the test suite. So I came up with another way of checking, which seems to pass all the tests, which compares the combined basetype with the basetype without any parts of the type the involve the middle class.

Sent a draft for some early feedback on how best to do the baseTypeWithout part. Now I need to make use of this ban in GADT reasoning, see the tests I copied into disabled.

@LPTK
Copy link
Contributor

LPTK commented Apr 4, 2022

Can you explain what's the high-level idea? As in, formally state the rules of what is accepted and what is rejected.

@dwijnand
Copy link
Member Author

dwijnand commented Apr 4, 2022

Not as of yet. As in, I have something that accepts the right classes and rejects the wrong ones, but I'm not sure how to describe it in words. I'm working on the failures in the real scala 2.13 collections (as opposed to the strawman collection tests I handle already) which might change the test. Ideally in a way which makes the test simpler and therefore easier to describe.

@dwijnand dwijnand changed the title Ban classes that refine type params outside of sub/supertypes Ban classes that incompatibly refine type params Jun 13, 2022
@dwijnand dwijnand force-pushed the checkable-isInstanceOf branch from 6e70794 to ff1441c Compare July 29, 2022 17:32
@dwijnand dwijnand marked this pull request as ready for review August 3, 2022 07:46
@dwijnand dwijnand requested a review from abgruszecki August 11, 2022 13:36
@abgruszecki
Copy link
Contributor

@dwijnand it would be good to have a textual description of the changes and to have Martin's yea/nay on it.

@dwijnand dwijnand force-pushed the checkable-isInstanceOf branch 2 times, most recently from 2069f63 to 592f664 Compare August 15, 2022 20:54
In upickle there was a misuse of Any in a contravariant position.
@dwijnand dwijnand force-pushed the checkable-isInstanceOf branch from 592f664 to f7f634b Compare August 16, 2022 06:57
@dwijnand dwijnand closed this Oct 10, 2022
@dwijnand dwijnand deleted the checkable-isInstanceOf branch October 10, 2022 15:47
@dwijnand dwijnand restored the checkable-isInstanceOf branch February 21, 2023 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No warning on uncheckable isInstanceOf call
3 participants