-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.6 bug: nested string interpolation is broken #40258
Labels
bug
Indicates an unexpected problem or unintended behavior
compiler:lowering
Syntax lowering (compiler front end, 2nd stage)
regression
Regression in behavior compared to a previous version
strings
"Strings!"
Comments
And just to confirm, the above is all true on julia> VERSION
v"1.7.0-DEV.717"
julia> v = "a $("b $("c")")"
"a b "
julia> length(v)
4
julia> macro pstring(str)
@info str
return quote
println("str1:", $(str))
println("str2: $($(str))")
end
end
@pstring (macro with 1 method)
julia> VERSION
v"1.7.0-DEV.717"
julia> @pstring "hello $("nathan")"
[ Info: "hello $("nathan")"
str1:hello nathan
str2: hello
julia> @macroexpand @pstring "hello $("nathan")"
[ Info: "hello $("nathan")"
quote
#= REPL[4]:4 =#
Main.println("str1:", "hello $("nathan")")
#= REPL[4]:5 =#
Main.println("str2: $("hello $("nathan")")")
end |
simeonschaub
added
parser
Language parsing and surface syntax
bug
Indicates an unexpected problem or unintended behavior
labels
Mar 29, 2021
vtjnash
added
the
regression
Regression in behavior compared to a previous version
label
Mar 29, 2021
FWIW I'm not sure if this is indeed related to the julia> e = Meta.parse(raw""" "str2: $("hello $("nathan")")" """)
:("str2: $("hello $("nathan")")")
julia> dump(e)
Expr
head: Symbol string
args: Array{Any}((2,))
1: String "str2: "
2: Expr
head: Symbol string
args: Array{Any}((2,))
1: String "hello "
2: Expr
head: Symbol string
args: Array{Any}((1,))
1: String "nathan"
julia> eval(e)
"str2: hello " |
Although I take that back, since it parses differently on 1.5, so the parser might indeed be the problem: julia> e = Meta.parse(raw""" "str2: $("hello $("nathan")")" """)
:("str2: $("hello nathan")")
julia> dump(e)
Expr
head: Symbol string
args: Array{Any}((2,))
1: String "str2: "
2: Expr
head: Symbol string
args: Array{Any}((2,))
1: String "hello "
2: String "nathan"
julia> VERSION
v"1.5.4"
|
It is completel gone after lowering: julia> f() = "a $("b $("c")")"
f (generic function with 1 method)
julia> @code_lowered f()
CodeInfo(
1 ─ %1 = Base.string("a ", "b ")
└── return %1
) |
simeonschaub
added
compiler:lowering
Syntax lowering (compiler front end, 2nd stage)
and removed
parser
Language parsing and surface syntax
labels
Mar 29, 2021
simeonschaub
added a commit
that referenced
this issue
Mar 29, 2021
simeonschaub
added a commit
that referenced
this issue
Mar 31, 2021
* fix #40258: nested string interpolation fixes #40258 * fix interpolation with varargs * add additional test case * add additional test cases Co-authored-by: Nathan Daly <NHDaly@gmail.com> * keep previous behavior, don't try to be too smart Co-authored-by: Nathan Daly <NHDaly@gmail.com> Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com>
KristofferC
pushed a commit
that referenced
this issue
Apr 4, 2021
* fix #40258: nested string interpolation fixes #40258 * fix interpolation with varargs * add additional test case * add additional test cases Co-authored-by: Nathan Daly <NHDaly@gmail.com> * keep previous behavior, don't try to be too smart Co-authored-by: Nathan Daly <NHDaly@gmail.com> Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com> (cherry picked from commit 637f52b)
KristofferC
pushed a commit
that referenced
this issue
Apr 4, 2021
* fix #40258: nested string interpolation fixes #40258 * fix interpolation with varargs * add additional test case * add additional test cases Co-authored-by: Nathan Daly <NHDaly@gmail.com> * keep previous behavior, don't try to be too smart Co-authored-by: Nathan Daly <NHDaly@gmail.com> Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com> (cherry picked from commit 637f52b)
KristofferC
pushed a commit
that referenced
this issue
Apr 4, 2021
* fix #40258: nested string interpolation fixes #40258 * fix interpolation with varargs * add additional test case * add additional test cases Co-authored-by: Nathan Daly <NHDaly@gmail.com> * keep previous behavior, don't try to be too smart Co-authored-by: Nathan Daly <NHDaly@gmail.com> Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com> (cherry picked from commit 637f52b)
ElOceanografo
pushed a commit
to ElOceanografo/julia
that referenced
this issue
May 4, 2021
* fix JuliaLang#40258: nested string interpolation fixes JuliaLang#40258 * fix interpolation with varargs * add additional test case * add additional test cases Co-authored-by: Nathan Daly <NHDaly@gmail.com> * keep previous behavior, don't try to be too smart Co-authored-by: Nathan Daly <NHDaly@gmail.com> Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com>
antoine-levitt
pushed a commit
to antoine-levitt/julia
that referenced
this issue
May 9, 2021
* fix JuliaLang#40258: nested string interpolation fixes JuliaLang#40258 * fix interpolation with varargs * add additional test case * add additional test cases Co-authored-by: Nathan Daly <NHDaly@gmail.com> * keep previous behavior, don't try to be too smart Co-authored-by: Nathan Daly <NHDaly@gmail.com> Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com>
johanmon
pushed a commit
to johanmon/julia
that referenced
this issue
Jul 5, 2021
* fix JuliaLang#40258: nested string interpolation fixes JuliaLang#40258 * fix interpolation with varargs * add additional test case * add additional test cases Co-authored-by: Nathan Daly <NHDaly@gmail.com> * keep previous behavior, don't try to be too smart Co-authored-by: Nathan Daly <NHDaly@gmail.com> Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com>
staticfloat
pushed a commit
that referenced
this issue
Dec 23, 2022
* fix #40258: nested string interpolation fixes #40258 * fix interpolation with varargs * add additional test case * add additional test cases Co-authored-by: Nathan Daly <NHDaly@gmail.com> * keep previous behavior, don't try to be too smart Co-authored-by: Nathan Daly <NHDaly@gmail.com> Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com> (cherry picked from commit 637f52b)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Indicates an unexpected problem or unintended behavior
compiler:lowering
Syntax lowering (compiler front end, 2nd stage)
regression
Regression in behavior compared to a previous version
strings
"Strings!"
Hello. :) I believe we have encountered a bug in the 1.6 release: nested string interpolation appears to be broken.
Consider this simple example:
Where the inner nested string is dropped. Compare this with the prior release which produces the correct answer:
I am running on macOS:
In case this is relevant, we came across this when a macro that includes string interpolation broke. As a very simple example, consider something like this:
Interestingly, the
@macroexpand
is different between 1.5 and 1.6, but as far as I can tell, both are equally valid expansions, so I don't think anything is wrong with the new expansion in 1.6. However, the 1.6 expansion creates nested string interpolation, which doesn't work in 1.6, even though it did work in 1.5:The text was updated successfully, but these errors were encountered: