Skip to content

Conversation

@JamesWrigley
Copy link
Member

As discussed in JuliaLang/JuliaSyntax.jl#600 and JuliaLang/JuliaSyntax.jl#615. Tested manually on 1.12. Should finally for-realsies fix JuliaLang/JuliaSyntax.jl#600 🤞

Copy link
Member

@c42f c42f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

is_paren_call=is_paren_call,
is_block=!is_paren_call && num_semis > 0)
end
end::NamedTuple{(:needs_parameters, :is_paren_call, :is_block, :delim_flags), Tuple{Bool, Bool, Bool, RawFlags}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly neater?

Suggested change
end::NamedTuple{(:needs_parameters, :is_paren_call, :is_block, :delim_flags), Tuple{Bool, Bool, Bool, RawFlags}}
end
opts::NamedTuple{(:needs_parameters, :is_paren_call, :is_block, :delim_flags), Tuple{Bool, Bool, Bool, RawFlags}}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually didn't realize that was possible 👀 Does a type-assert after the variable initialization have the same effect? I think I have a mild preference for the current version because that's clearer to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type-inference knows that opts is constrained by the type-assert everywhere "downstream" of this, so this should be effectively the same in practice yeah

(no opinion from me w.r.t. style)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup what Cody said. To expand: type inference follows the data flow according to program control flow. Unlike in some languages, the type assert opts::T is not a global statement about the binding opts. It just asserts the type of the value bound to opts is T at that one point in the program and inference can follow the program dataflow from there.

Style-wise I think it makes slight sense to separate performance annotations from the rest of the code as they're not semantically relevant for humans reading the code. But that's nitpicking, I think this is fine and we can just merge it :)

@JamesWrigley JamesWrigley added backport 1.12 Change should be backported to release-1.12 backport 1.13 Change should be backported to release-1.13 labels Jan 4, 2026
@c42f c42f merged commit 05c973a into JuliaLang:master Jan 5, 2026
11 checks passed
@JamesWrigley JamesWrigley deleted the parse-brackets-typeassert branch January 5, 2026 09:50
JamesWrigley added a commit to JamesWrigley/JuliaSyntax.jl that referenced this pull request Jan 5, 2026
This was referenced Jan 9, 2026
N5N3 pushed a commit to N5N3/JuliaSyntax.jl that referenced this pull request Jan 11, 2026
c42f pushed a commit to JuliaLang/JuliaSyntax.jl that referenced this pull request Jan 12, 2026
@DilumAluthge
Copy link
Member

Same comment as #60403 (comment):

I see the backport 1.12 label on this PR, but of course JuliaSyntax doesn't live in the JuliaLang/julia repo for 1.12.

@mlechu @topolarity Can I assume that y'all will go through the same backports process for this PR as described in #60246 (comment)? If so, we can remove the backport 1.12 label from this PR - otherwise, the Backporter script will keep trying to backport it.

@DilumAluthge
Copy link
Member

From #60403 (comment):

Yeah this has a confusing history 😅 It was already backported in JuliaLang/JuliaSyntax.jl#613, but there was no PR to update the JuliaSyntax version in 1.12 because I then discovered it didn't work on 1.12: JuliaLang/JuliaSyntax.jl#600 (comment)

So then we made #60476 instead, which was backported to JuliaSyntax: JuliaLang/JuliaSyntax.jl#616

TL;DR: #60641 contains both this PR and #60476.

So this PR (#60476) is included in #60641.

JamesWrigley added a commit to JamesWrigley/JuliaSyntax.jl that referenced this pull request Jan 23, 2026
KristofferC pushed a commit to JuliaLang/JuliaSyntax.jl that referenced this pull request Feb 4, 2026
@KristofferC KristofferC mentioned this pull request Feb 4, 2026
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.12 Change should be backported to release-1.12 backport 1.13 Change should be backported to release-1.13

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parse_brackets should probably specialize on the function

5 participants