But the way this is implemented in the reference parser (and copied here) the precedence doesn't work when chained with normal unary ops. This happens because parse_unary is still involved in parsing chained unary type operators.
julia> parsestmt(SyntaxNode, "<: A where B")
line:col│ tree │ file_name
1:1 │[<:-pre]
1:3 │ [where]
1:4 │ A
1:12 │ B
julia> parsestmt(SyntaxNode, "+ <: A where B")
line:col│ tree │ file_name
1:1 │[where]
1:1 │ [call-pre]
1:1 │ +
1:2 │ [<:-pre]
1:6 │ A
1:14 │ B
Fixing this isn't super simple - if we call parse_unary_subtype from within parse_unary, we'll break the precedence of juxtaposition which is interposed between these two. For example, we must have "√2i" parse as (juxtapose (call-pre √ 2) i).
The precedence of type operators
<:
is meant to be lower thanwhere
as handled with a special ruleparse_unary_subtype
(see https://github.com/JuliaLang/julia/pull/21567).But the way this is implemented in the reference parser (and copied here) the precedence doesn't work when chained with normal unary ops. This happens because
parse_unary
is still involved in parsing chained unary type operators.Fixing this isn't super simple - if we call
parse_unary_subtype
from withinparse_unary
, we'll break the precedence of juxtaposition which is interposed between these two. For example, we must have"√2i"
parse as(juxtapose (call-pre √ 2) i)
.