Skip to content

Commit 3598a2b

Browse files
committed
Minor tweaks to remove method ambiguities and argument ambiguities
These were harmless enough, but should satisfy the tests in Base. Also remove a display_error() overload because (a) it's not designed to be overridden, and (b) this override doesn't really have the intended effect anyway in the latest version where the REPL uses exception stacks more extensively.
1 parent 671841b commit 3598a2b

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/parser_api.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ function Base.showerror(io::IO, err::ParseError)
2020
show_diagnostics(io, err.diagnostics, err.source)
2121
end
2222

23-
Base.display_error(io::IO, err::ParseError, bt) = Base.showerror(io, err, bt)
24-
25-
2623
"""
2724
parse!(stream::ParseStream; rule=:all)
2825

src/syntax_tree.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ mutable struct TreeNode{NodeData} # ? prevent others from using this with Node
77
parent::Union{Nothing,TreeNode{NodeData}}
88
children::Union{Nothing,Vector{TreeNode{NodeData}}}
99
data::Union{Nothing,NodeData}
10+
11+
# Use this constructor rather than the automatically generated one to pass
12+
# Test.detect_unbound_args() test in Base.
13+
function TreeNode{NodeData}(parent::Union{Nothing,TreeNode{NodeData}},
14+
children::Union{Nothing,Vector{TreeNode{NodeData}}},
15+
data::Union{Nothing,NodeData}) where {NodeData}
16+
new{NodeData}(parent, children, data)
17+
end
1018
end
1119

1220
# Implement "pass-through" semantics for field access: access fields of `data`

src/tokenize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Tokenize
22

3-
export tokenize, untokenize, Tokens
3+
export tokenize, untokenize
44

55
using ..JuliaSyntax: JuliaSyntax, Kind, @K_str, @KSet_str
66

test/utils.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@
1515
@test ps("XX", fgcolor=:red, bgcolor=:green, href="https://www.example.com") ==
1616
"\e]8;;https://www.example.com\e\\\e[31m\e[42mXX\e[0;0m\e]8;;\e\\"
1717
end
18+
19+
@testset "ambiguities" begin
20+
if VERSION >= v"1.8"
21+
@test detect_ambiguities(JuliaSyntax) == []
22+
@test detect_unbound_args(JuliaSyntax) == []
23+
end
24+
end

0 commit comments

Comments
 (0)