From fa7ce1806fdd9d8bc13fb5ca6fda39730fed17b0 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Mon, 15 Nov 2021 14:28:56 -0500 Subject: [PATCH] fix #41727, field doc string with interpolation (#43061) --- src/julia-syntax.scm | 2 +- test/docs.jl | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 35acc10eec6fb1..bfd3c8fface0da 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -904,7 +904,7 @@ x)) fields))) (attrs (reverse attrs)) - (defs (filter (lambda (x) (not (effect-free? x))) defs)) + (defs (filter (lambda (x) (not (or (effect-free? x) (eq? (car x) 'string)))) defs)) (locs (if (and (pair? fields0) (linenum? (car fields0))) (list (car fields0)) '())) diff --git a/test/docs.jl b/test/docs.jl index 41c3746d7476f3..762a481ee4801d 100644 --- a/test/docs.jl +++ b/test/docs.jl @@ -1504,3 +1504,12 @@ end # Issue #13109 eval(Expr(:block, Expr(:macrocall, GlobalRef(Core, Symbol("@doc")), nothing, "...", Expr(:module, false, :MBareModuleEmpty, Expr(:block))))) @test docstrings_equal(@doc(MBareModuleEmpty), doc"...") + +# issue #41727 +"struct docstring" +struct S41727 + "x is $(2*2)" + x +end +@test S41727(1) isa S41727 +@test string(@repl S41727.x) == "x is 4\n"