Skip to content

Commit

Permalink
fix #40258: nested string interpolation
Browse files Browse the repository at this point in the history
fixes #40258
  • Loading branch information
simeonschaub committed Mar 29, 2021
1 parent 40267bb commit 3d1fec5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2383,11 +2383,12 @@

'string
(lambda (e)
(expand-forms
`(call (top string) ,@(map (lambda (s)
(if (and (pair? s) (eq? (car s) 'string))
(cadr s)
s))
`(call (top string)
,@(apply append (map (lambda (s)
(let ((s (expand-forms s)))
(if (and (pair? s) (eq? (car s) 'string))
(cdr s)
(list s))))
(cdr e)))))

'|::|
Expand Down
3 changes: 3 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2751,3 +2751,6 @@ end
@test eval(:(x = $(QuoteNode(Core.SlotNumber(1))))) == Core.SlotNumber(1)
@test_throws ErrorException("syntax: SSAValue objects should not occur in an AST") eval(:(x = $(Core.SSAValue(1))))
@test_throws ErrorException("syntax: Slot objects should not occur in an AST") eval(:(x = $(Core.SlotNumber(1))))

# issue 40258
@test "a $("b $("c")")" == "a b c"

0 comments on commit 3d1fec5

Please sign in to comment.