-
Notifications
You must be signed in to change notification settings - Fork 33
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
ERROR: type String has no field head #167
Comments
Does this documentation syntax actually work? |
Oh, that's a good question... 😕 Maybe a good linter message instead of error? |
Yes, I think that's the better approach. As far as I can tell, documenting outer constructors works, while "documenting" inner constructors doesn't seem to do anything. |
I am having a similar problem with valid documentation string syntax. Type definitions with field documentation seems to cause the same error reported by @innerlee. I first encountered this with the following code: """
ContinuousFile(io::IOStream)
Type for an open continuous file.
# Fields
**`io`** `IOStream` object.
**`nsample`** number of samples in a file.
**`nblock`** number of data blocks in a file.
**`header`** [`OriginalHeader`](@ref) of the current file.
"""
immutable ContinuousFile{T<:Integer, S<:Integer, H<:OriginalHeader}
"IOStream for open continuous file"
io::IOStream
"Number of samples in file"
nsample::T
"Number of data blocks in file"
nblock::S
"File header"
header::H
end But it can also be recreated with simpler REPL examples, e.g.: julia> lintstr("""
immutable foo
"bar field"
bar::Int
end
""")
ERROR: type String has no field head
in linttype(::Expr, ::Lint.LintContext) at /home/galen/.julia/v0.5/Lint/src/types.jl:99
in lintexpr(::Expr, ::Lint.LintContext) at /home/galen/.julia/v0.5/Lint/src/Lint.jl:228
in lintstr(::String, ::Lint.LintContext, ::Int64) at /home/galen/.julia/v0.5/Lint/src/Lint.jl:151
in lintstr(::String) at /home/galen/.julia/v0.5/Lint/src/Lint.jl:124 |
This docstring syntax is not valid docstring syntax as far as I know. But this is nevertheless a bug that should be fixed. Thanks for bringing it to our attention. |
You can at least access this type of field documentation in the REPL,
though I have been unable to find anything in the Julia documentation
explicitly mentioning it.
…On Tue, Dec 27, 2016 at 9:24 PM Fengyang Wang ***@***.***> wrote:
This docstring syntax is not valid docstring syntax as far as I know. But
this is nevertheless a bug that should be fixed.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#167 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGg8zxbahK3L8013wufkC_kOZDikOFXSks5rMchmgaJpZM4K9Egz>
.
|
@galenlynch How does one access this type of field documentation from the REPL? |
You can access it by entering julia> "A type doc string" type foo
"a field doc string"
bar::Int
end
help?> foo.bar
a field doc string |
Thanks, this is useful information. This issue is fixed by #179. |
Thanks for fixing it! |
This error happens if you want to add some inline doc to the inner constructor. One way to bypass this error:
at https://github.com/tonyhffong/Lint.jl/blob/master/src/types.jl#L99,
before the first use of
def.head
, add the following codeThe text was updated successfully, but these errors were encountered: