Skip to content

Redundancy Checker#1314

Merged
paf31 merged 1 commit intopurescript:masterfrom
nicodelpiano:redundancy3.1
Jul 28, 2015
Merged

Redundancy Checker#1314
paf31 merged 1 commit intopurescript:masterfrom
nicodelpiano:redundancy3.1

Conversation

@nicodelpiano
Copy link
Copy Markdown
Contributor

Written on top of the exhaustivity checker, it checks for the existence of overlapping patterns.

Example:

module Main where
f true true = 0
f true false = 0
f true true = 0

It throws:

 Warning in module Main:
 Warning in value declaration f:
 Warning at /dev/stdin line 2, column 1 - line 3, column 1:
      Redundant cases has been detected.
      The definitions has the following redundant cases:

      true true

TODO:

  • Support for arrays and literals

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/s/has/have

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ups!

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Jul 28, 2015

This looks great! Just see my few notes above.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Jul 28, 2015

@garyb Any comments on this? I've reviewed it once but not tested it yet. Will do so later today, then merge if there are no concerns.

Throws the overlapping cases in pattern matching definitions.
@garyb
Copy link
Copy Markdown
Member

garyb commented Jul 28, 2015

Nothing from me, looks 👍

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Jul 28, 2015

Tested, looks good. I'll merge this once Travis finishes and I can check the core-tests log.

@nicodelpiano
Copy link
Copy Markdown
Contributor Author

@paf31 👍 Great! Can you merge it from this branch?

paf31 added a commit that referenced this pull request Jul 28, 2015
@paf31 paf31 merged commit d96b0ef into purescript:master Jul 28, 2015
@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Jul 28, 2015

Looks like it. Nice work 😄

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Jul 28, 2015

Let's fill in the wiki page for the new warning by the way.

@nicodelpiano
Copy link
Copy Markdown
Contributor Author

@paf31 😄 Yes, I'll do it! Thanks!

@nicodelpiano nicodelpiano deleted the redundancy3.1 branch July 28, 2015 22:44
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.

3 participants