Skip to content
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

Cannot instantiate struct with field docstring interpolation #41727

Closed
aplavin opened this issue Jul 29, 2021 · 0 comments · Fixed by #43061
Closed

Cannot instantiate struct with field docstring interpolation #41727

aplavin opened this issue Jul 29, 2021 · 0 comments · Fixed by #43061
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior docsystem The documentation building system

Comments

@aplavin
Copy link
Contributor

aplavin commented Jul 29, 2021

MWE:

julia> "" struct S1
           " $(2*2) "
           x
       end

julia> S1(1)
ERROR: MethodError: no method matching S1(::Int64)

julia> methods(S1)
# 0 methods for type constructor:

help?> S1.x
  4

I would expect the result equivalent to the following:

julia> "" struct S
           " 4 "
           x
       end

julia> S(1)
S(1)

julia> methods(S)
# 1 method for type constructor:
[1] S(x) in Main at REPL[17]:2

help?> S.x
  4

I'm using the latest julia release:

julia> versioninfo()
Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
@JeffBezanson JeffBezanson added docsystem The documentation building system bug Indicates an unexpected problem or unintended behavior labels Jul 30, 2021
@JeffBezanson JeffBezanson self-assigned this Jul 30, 2021
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 docsystem The documentation building system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants