Skip to content

String interpolation with terminal dot breaking 1.2 -> 1.3 #33044

@matbesancon

Description

@matbesancon

This is more a difference than a bug, but definitely breaking:

1.2:

julia> var = 3
3
julia> println("Hello from var $var.")
Hello from var 3.

1.3-rc1:

julia> var = 3
3

julia> println("Hello from var $var.")
ERROR: syntax: unexpected ")"
Stacktrace:
 [1] top-level scope at REPL[1]:0

From HISTORY.md:

Non-parenthesized interpolated variables in strings, e.g. "$x", must be followed by a character that will never be an allowed identifier character (currently operators, space/control characters, or common punctuation characters) (#25231).

So this was sort of warned but not erroring before 1.3

Edit

Going even deeper, the error does not happen with 1-char variable identifiers:

julia> x = 1
1

julia> "$x."
"1."

julia> println("$x.")
1.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions