Skip to content

Handle Julia 1.12 expressions with multiple semicolons - #53

Merged
omus merged 5 commits into
masterfrom
cv/julia-1.12-compat
Aug 14, 2026
Merged

Handle Julia 1.12 expressions with multiple semicolons#53
omus merged 5 commits into
masterfrom
cv/julia-1.12-compat

Conversation

@omus

@omus omus commented Aug 14, 2026

Copy link
Copy Markdown
Member

Fixes #43. In Julia 1.12 the way the expression (x; y; z) -> 0 differs from older versions of Julia:

Julia 1.12.6:

julia> Meta.@dump (x; y; z) -> 0
Expr
  head: Symbol ->
  args: Array{Any}((2,))
    1: Expr
      head: Symbol tuple
      args: Array{Any}((2,))
        1: Expr
          head: Symbol parameters
          args: Array{Any}((2,))
            1: Expr
              head: Symbol parameters
              args: Array{Any}((1,))
                1: Symbol z
            2: Symbol y
        2: Symbol x
    2: Expr
      head: Symbol block
      args: Array{Any}((2,))
        1: LineNumberNode
          line: Int64 1
          file: Symbol REPL[2]
        2: Int64

Julia 1.11.9

julia> Meta.@dump (x; y; z) -> 0
Expr
  head: Symbol ->
  args: Array{Any}((2,))
    1: Expr
      head: Symbol block
      args: Array{Any}((5,))
        1: Symbol x
        2: LineNumberNode
          line: Int64 1
          file: Symbol REPL[1]
        3: Symbol y
        4: LineNumberNode
          line: Int64 1
          file: Symbol REPL[1]
        5: Symbol z
    2: Expr
      head: Symbol block
      args: Array{Any}((2,))
        1: LineNumberNode
          line: Int64 1
          file: Symbol REPL[1]
        2: Int64 0

This syntax isn't a valid function so I've updated the code to detect this as an invalid definition.

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.46%. Comparing base (f650f43) to head (1a117ac).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #53      +/-   ##
==========================================
+ Coverage   97.41%   97.46%   +0.05%     
==========================================
  Files           6        6              
  Lines         232      237       +5     
==========================================
+ Hits          226      231       +5     
  Misses          6        6              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/function.jl
def[:kwargs] = ex.args[i].args
def[:kwargs] = Any[]
for arg in ex.args[i].args
if arg isa Expr && arg.head === :parameters

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if arg isa Expr && arg.head === :parameters
if Meta.isexpr(arg, :parameters)

I am surprised that isn't used more in here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We should probably update this code to use Meta.isexpr. I'll leave it as I wrote it though so that everything is consistent. We can do a follow up PR for that change.

@omus
omus force-pushed the cv/julia-1.12-compat branch from 93ffad0 to 69b79e9 Compare August 14, 2026 09:43
@omus

omus commented Aug 14, 2026

Copy link
Copy Markdown
Member Author

I'll leave the fix for the nightly failure out of this PR

@omus
omus merged commit 05c572d into master Aug 14, 2026
14 of 15 checks passed
@omus
omus deleted the cv/julia-1.12-compat branch August 14, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI failing in Julia 1.12

2 participants