diff --git a/src/parser_api.jl b/src/parser_api.jl index 68d6baf6..ffc6538f 100644 --- a/src/parser_api.jl +++ b/src/parser_api.jl @@ -20,9 +20,6 @@ function Base.showerror(io::IO, err::ParseError) show_diagnostics(io, err.diagnostics, err.source) end -Base.display_error(io::IO, err::ParseError, bt) = Base.showerror(io, err, bt) - - """ parse!(stream::ParseStream; rule=:all) diff --git a/src/syntax_tree.jl b/src/syntax_tree.jl index 76c4e3d6..e8ce3a50 100644 --- a/src/syntax_tree.jl +++ b/src/syntax_tree.jl @@ -7,6 +7,14 @@ mutable struct TreeNode{NodeData} # ? prevent others from using this with Node parent::Union{Nothing,TreeNode{NodeData}} children::Union{Nothing,Vector{TreeNode{NodeData}}} data::Union{Nothing,NodeData} + + # Use this constructor rather than the automatically generated one to pass + # Test.detect_unbound_args() test in Base. + function TreeNode{NodeData}(parent::Union{Nothing,TreeNode{NodeData}}, + children::Union{Nothing,Vector{TreeNode{NodeData}}}, + data::Union{Nothing,NodeData}) where {NodeData} + new{NodeData}(parent, children, data) + end end # Implement "pass-through" semantics for field access: access fields of `data` diff --git a/src/tokenize.jl b/src/tokenize.jl index cb31f746..7f54a980 100644 --- a/src/tokenize.jl +++ b/src/tokenize.jl @@ -1,6 +1,6 @@ module Tokenize -export tokenize, untokenize, Tokens +export tokenize, untokenize using ..JuliaSyntax: JuliaSyntax, Kind, @K_str, @KSet_str diff --git a/test/utils.jl b/test/utils.jl index 227077f6..371da98c 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -15,3 +15,10 @@ @test ps("XX", fgcolor=:red, bgcolor=:green, href="https://www.example.com") == "\e]8;;https://www.example.com\e\\\e[31m\e[42mXX\e[0;0m\e]8;;\e\\" end + +@testset "ambiguities" begin + if VERSION >= v"1.8" + @test detect_ambiguities(JuliaSyntax) == [] + @test detect_unbound_args(JuliaSyntax) == [] + end +end