Skip to content
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

Incorrect position on @warn #86

Open
gafter opened this issue Jun 13, 2023 · 0 comments
Open

Incorrect position on @warn #86

gafter opened this issue Jun 13, 2023 · 0 comments
Labels

Comments

@gafter
Copy link
Member

gafter commented Jun 13, 2023

The following test is not correct:

    if VERSION >= v"1.8"
        @testset "warn for unreachable cases" begin
            let line = (@__LINE__) + 4
                @test_warn(
                    "$file:$line: Case 2: `Foo(1, 2) =>` is not reachable.",
                    # Test macros remove line number nodes, so we can only get the start of it
                    @eval @match2 Foo(1, 2) begin; Foo(_, _) => 1; Foo(1, 2) => 2; end
                    )
            end
        end
    end

Specifically, the comment is incorrect. Test macros do no such thing. I have a similar test in AutoHashEqualsCached.jl that works with no such accommodation. I suspect the reason the line numbers were wrong in this test is that the pattern-matching implementation has a bug in tracking the line numbers. Fix the bug and the line numbers will be correct.

@gafter gafter transferred this issue from JuliaServices/Rematch2.jl Aug 3, 2023
@gafter gafter added the bug label Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant