Skip to content

Fix #3004 and simplify exhaustivity check #3011

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

Merged
merged 11 commits into from
Aug 25, 2017

Conversation

liufengyun
Copy link
Contributor

Fix #3004 and simplify exhaustivity check

@liufengyun
Copy link
Contributor Author

Review @AleksanderBG ?

@@ -641,6 +628,15 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {

/** Display spaces */
def show(s: Space): String = {
def params(tp: Type): List[Type] = {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function seems to be mostly doing unnecessary work - the actual types returned are never used, and the only thing that matters is the length of the returned list.

Copy link
Contributor

@abgruszecki abgruszecki Aug 24, 2017

Choose a reason for hiding this comment

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

To clarify, I've checked that the length of .firstParamTypes does not actually change - all tests still pass if this function returns ktor.firstParamTypes.

@abgruszecki
Copy link
Contributor

@liufengyun - I've tried to review what I can, and apart from that single nitpick everything looks good to me. I'm a bit out of my depth when it comes to verifying that the new implementation of signature is correct, though. I must say that unifying Kon and Fun spaces seems like a very good approach - the overall algorithm now looks much cleaner.

@@ -1 +1,3 @@
13: Pattern Match Exhaustivity: Node2(), Node1(Foo(_))
13: Pattern Match Exhaustivity: Node2()
17: Pattern Match Exhaustivity: Node2(), Node1(Foo(Nil)), Node1(Foo(List(_, _*)))
Copy link
Member

Choose a reason for hiding this comment

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

Should List(_, _*) be List(_, _: _*) ?

@liufengyun
Copy link
Contributor Author

Thanks @AleksanderBG . The signature is stolen from the new patternMatcher, which follows the specification closely.

@smarter
Copy link
Member

smarter commented Aug 24, 2017

The signature is stolen from the new patternMatcher, which follows the specification closely.

Would be nice to add a comment pointing to the corresponding code in the pattern matcher. Even nicer if we could share some code but I don't know if that's possible here :).

@liufengyun
Copy link
Contributor Author

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 jobs in total.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/3011 to see the changes.

@liufengyun liufengyun merged commit f89e618 into scala:master Aug 25, 2017
@liufengyun liufengyun deleted the fix-3004 branch August 25, 2017 17:51
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.

4 participants