Open

Description
This definition should raise an error because there are two identical match clauses and the second one is unreachable:
julia> function foo(x)
@match x begin
Rational{Int}(num, den) => begin print("one"); 1 end
Rational{Int}(num, den) => begin print("two"); 2 end
end
end
foo (generic function with 1 method)
julia> foo(3//4)
one1
In fact, maybe we should consider erroring in general if there are unreachable clauses? For example, in this definition, the second clause is unreachable because the first clause matches everything, which should also probably raise an error:
julia> @match 2//3 begin
_ => 1
Rational{Int}(x,y) => 2
end
1
Metadata
Metadata
Assignees
Labels
No labels