Skip to content

Pattern matching + Null<T> sometimes skip default case #3680

Closed
@waneck

Description

@waneck

Example:

class Main
{
    static function main() 
    {
        switch (new Node(1))
        {
            case { cur: 1, next: ({ cur : 2, next : _ }) }:
                throw "assert";
            case _:
                trace('correct');
        }
    }

}

class Node<T>
{
    public var cur:T;
    public var next:Null<Node<T>>;
    public function new(cur)
    {
        this.cur = cur;
    }
}

This should trace correct, but instead doesn't trace anything and does not throw either.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions