Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Useless pattern checks with `|` #2508

andyli opened this Issue · 2 comments

2 participants

Andy Li Simon Krajewski
Andy Li

Based on an example at the bottom of :

enum Tree<T> {
    Node(l:Tree<T>, r:Tree<T>);

class Test<T> {
    static function main():Void {
        switch(Leaf("foo")) {
            case Leaf(_)
               | Leaf("foo"): // This pattern is unused
            case Node(l,r):

Tested with 568efe5 and the above was compiled without any error.

Changing that to case Leaf(_): case Leaf("foo"): correctly caused a compilation error.

Simon Krajewski Simn was assigned
Simon Krajewski

This looks like a regression, but I don't actually know why it was working before. Unfortunately the uselessness checks are based on cases, not on patterns. I'll see if this can be changed without much hassle.

Simon Krajewski Simn closed this in c7aff75
Simon Krajewski Simn referenced this issue from a commit
Simon Krajewski Simn add test for issue #2508 cc4ce36
Simon Krajewski Simn reopened this
Simon Krajewski Simn modified the milestone: 3.2, 3.1.0
Simon Krajewski

I'll check this again after the 3.1.0 release. I prefer having this broken over the false positives in issue #2610.

Simon Krajewski Simn modified the milestone: 3.3, 3.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.