From 3f377c07390cd2a79de237ff00946a51d4d8c2a8 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Fri, 22 Nov 2024 16:51:33 +0100 Subject: fix(julia): treat :: as operator in type contexts This patch captures `::` as `@operator` within `(unary_typed_expression)` and `(typed_expression)`. These should be the only two cases that the parser can emit when encountering `::` in the source, but as a fallback it is still captured as `@punctuation` in all other cases. The reasons for capturing `::` as an operator are i) the close relation with the other type-operators `<:` and `>:` and ii) the fact that it is treated as an operator by the Julia parser, just like `<:` and `>:`. --- tests/query/highlights/julia/test.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/query/highlights/julia/test.jl b/tests/query/highlights/julia/test.jl index 445efaa1f..338b7f8a1 100644 --- a/tests/query/highlights/julia/test.jl +++ b/tests/query/highlights/julia/test.jl @@ -2,13 +2,13 @@ function load_data(::Symbol; ::Int) :: Tuple # <- @keyword.function # ^ @function.call # ^ @punctuation.bracket -# ^^ @punctuation.delimiter +# ^^ @operator # ^ @type.builtin # ^ @punctuation.delimiter -# ^^ @punctuation.delimiter +# ^^ @operator # ^^^ @type.builtin # ^ @punctuation.bracket -# ^^ @punctuation.delimiter +# ^^ @operator # ^ @type.builtin dataset = CIFAR10(; Tx = Float32, split = split) # ^^^^^^^ @variable -- cgit v1.2.3-70-g09d2