Skip to content

Commit c145497

Browse files
authored
Merge pull request #322 from julia-vscode/sp/fix-string-type-interpolation
fix bare interpolation of "type" in strings
2 parents 146bb1b + 3fdcefc commit c145497

File tree

5 files changed

+13
-25
lines changed

5 files changed

+13
-25
lines changed

.github/workflows/jlpkgbutler-ci-master-workflow.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ${{ matrix.os }}
1111
strategy:
1212
matrix:
13-
julia-version: ['1.0', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6']
13+
julia-version: ['1.0', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7']
1414
julia-arch: [x64, x86]
1515
os: [ubuntu-latest, windows-latest, macOS-latest]
1616
exclude:
@@ -37,4 +37,3 @@ jobs:
3737
name: codecov-umbrella
3838
fail_ci_if_error: false
3939
token: ${{ secrets.CODECOV_TOKEN }}
40-

.github/workflows/jlpkgbutler-ci-pr-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ${{ matrix.os }}
1010
strategy:
1111
matrix:
12-
julia-version: ['1.0', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6']
12+
julia-version: ['1.0', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7']
1313
julia-arch: [x64, x86]
1414
os: [ubuntu-latest, windows-latest, macOS-latest]
1515
exclude:

.github/workflows/jlpkgbutler-codeformat-pr-workflow.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/components/strings.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ function parse_string_or_cmd(ps::ParseState, prefixed=false)
189189
if kindof(ps1.t) === Tokens.WHITESPACE
190190
error("Unexpected whitespace after \$ in String")
191191
else
192-
t = INSTANCE(ps1)
192+
# foo in $foo is always parsed as an identifier by Julia,
193+
# no matter whether it actually is a keyword
194+
t = EXPR(:IDENTIFIER, ps1)
193195
end
194196
# Attribute trailing whitespace to the string
195197
t = adjustspan(t)

test/parser.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,4 +1335,12 @@ end
13351335
@testset "#311" begin
13361336
@test test_expr(raw"import a.$b.c")
13371337
end
1338+
1339+
@testset "kw interpolation" begin
1340+
@test test_expr(raw""""foo $bar" """)
1341+
@test test_expr(raw""""foo $type" """)
1342+
@test test_expr(raw""""foo $function" """)
1343+
@test test_expr(raw""""foo $begin" """)
1344+
@test test_expr(raw""""foo $quote" """)
1345+
end
13381346
end

0 commit comments

Comments
 (0)