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

Second of two consecutive strings is ignored #12737

Closed
eschnett opened this issue Aug 21, 2015 · 7 comments · Fixed by #13708
Closed

Second of two consecutive strings is ignored #12737

eschnett opened this issue Aug 21, 2015 · 7 comments · Fixed by #13708
Labels
bug Indicates an unexpected problem or unintended behavior docsystem The documentation building system parser Language parsing and surface syntax

Comments

@eschnett
Copy link
Contributor

With Julia 0.4.0-dev, the input "a" "b" in the REPL leads to the output "a" instead of a string concatenation or an error. The second string "b" is silently discarded.

@JeffBezanson
Copy link
Member

Possibly related:

julia> "docs"
       global xx = 10
  docs

The doc string seems to be printed.

@mbauman
Copy link
Member

mbauman commented Aug 21, 2015

Hah, you just documented "b" with the docstring "a". I agree it's pretty surprising, but I guess the only strange thing here is that it returned the docstring instead of the object being documented (or maybe both, displayed with @doc syntax?)

@JeffBezanson JeffBezanson added the docsystem The documentation building system label Aug 21, 2015
@JeffBezanson
Copy link
Member

I'm not sure we need to allow documenting strings. It seems like in every case you'd want to document a string-valued variable instead of the string itself.

@eschnett
Copy link
Contributor Author

It seems that one can document functions, variable definitions, and simple values (e.g. strings, integers). Expressions and function calls cannot be documented; this leads to a method error.

@JeffBezanson JeffBezanson added the bug Indicates an unexpected problem or unintended behavior label Sep 17, 2015
@ihnorton ihnorton added the parser Language parsing and surface syntax label Oct 12, 2015
@artkuo
Copy link
Contributor

artkuo commented Oct 14, 2015

I've traced the problem down to operators.jl, which is compiled after about a dozen other .jl files by sysimg.jl. Docstrings in files earlier than that (e.g. range.jl) can get the error. Also docstrings in operators.jl up to line 11: ==(x,y) = x === y. After that, docstrings seem to be okay. This would appear to be addressed by #13602, although I haven't tested it.

@MichaelHatherly
Copy link
Member

This would appear to be addressed by #13602

This isn't addressed by #13602. The reference in #13534 (comment) to this issue was regarding duplicating the docstring appearing to fix the issue, not the == to === change I've made in #13602.

@artkuo
Copy link
Contributor

artkuo commented Oct 15, 2015

Doesn't #13602 now allow early docstrings? My interpretation is that if you had a docstring earlier than that line 11, the original code was using == before it was defined as such, and caused errors, as was the case in #13534. Not by fixing that line 11, but allowing docstrings to be defined without relying on it. I hope I'm not misunderstanding. In any case, #13602 was a nice fix and certainly cleared up the problem I was seeing.

MichaelHatherly added a commit to MichaelHatherly/julia that referenced this issue Oct 21, 2015
This fixes JuliaLang#12737 by throwing an error when trying to document unbound
string literals. String-valued variables can still be documented though.

Also improves error reporting for invalid doc expressions and adds tests.
tkelman pushed a commit that referenced this issue Oct 31, 2015
This fixes #12737 by throwing an error when trying to document unbound
string literals. String-valued variables can still be documented though.

Also improves error reporting for invalid doc expressions and adds tests.

(cherry picked from commit 922c395)
ref #13708
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 parser Language parsing and surface syntax
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants