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 incorrect detection of exhaustive matches for structural equality comparisons on some primitives. #2342

Merged
merged 2 commits into from
Nov 17, 2017

Conversation

mfelsche
Copy link
Contributor

for primitives that have custom 'eq' methods or implement Equatable[T] where T is a subtype of the primitive.

The type was inferred by looking at the type of the full case AST which was inferred
from the first argument of the eq method. Now the exhaustive match logic is
considering the actual type of the case expression.

This should fix #2327

for primitives that have custom 'eq' methods or implement Equatable[T] where T is a subtype of the primitive.

The type was inferred by looking at the type of the full case AST which was inferred
from the first argument of the eq method. Now the exhaustive match logic is
considering the actual type of the case expression.
@mfelsche mfelsche added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Nov 15, 2017
@mfelsche mfelsche requested a review from jemc November 15, 2017 22:07
Copy link
Member

@jemc jemc left a comment

Choose a reason for hiding this comment

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

Don't we also want a test that shows that just covering the X and Y case is not exhaustive?

@mfelsche
Copy link
Contributor Author

It was failing on OSX for the stdlib tests compiled in release mode:

**** FAILED: process/STDERR
dispose: child exit code: 1
dispose: stdout: 0 bytes
dispose: stderr: cat: file_does_not_exist: No such file or directory
dispose: total data process_time: 	948955332209 ns
dispose: ProcessNotify lifetime: 	51128992 ns
ProcessError: KillError

restarting the job.

@mfelsche
Copy link
Contributor Author

@jemc added that test

@jemc jemc changed the title Fix incorrect detection of exhaustive matches Fix incorrect detection of exhaustive matches for structural equality comparisons on some primitives. Nov 17, 2017
@jemc jemc merged commit 5d386d1 into master Nov 17, 2017
ponylang-main added a commit that referenced this pull request Nov 17, 2017
@jemc jemc deleted the fix-exhaustive-on-primitives branch November 17, 2017 16:56
@jemc
Copy link
Member

jemc commented Nov 17, 2017

Great work!

@mfelsche
Copy link
Contributor Author

It was a pleasure, an honour!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exhaustive match incorrectly handling instances in cases
2 participants