Closed GeopJr closed 3 years ago
According to the stack trace, the error appears to be inside markd
(which Crystal 1.1.1 didn't use).
Negative count: -70 (ArgumentError)
from /home/johannes/Projects/crystal-lang/crystal/src/indexable.cr:921:5 in 'byte_slice?'
from /home/johannes/Projects/crystal-lang/crystal/src/string.cr:1154:5 in 'byte_slice'
from /home/johannes/Projects/crystal-lang/crystal/lib/markd/src/markd/parsers/inline.cr:229:44 in 'close_bracket'
from /home/johannes/Projects/crystal-lang/crystal/lib/markd/src/markd/parsers/inline.cr:52:15 in 'process_line'
from /home/johannes/Projects/crystal-lang/crystal/lib/markd/src/markd/parsers/inline.cr:24:22 in 'parse'
from /home/johannes/Projects/crystal-lang/crystal/lib/markd/src/markd/parsers/block.cr:198:11 in 'process_inlines'
from /home/johannes/Projects/crystal-lang/crystal/lib/markd/src/markd/parsers/block.cr:59:9 in 'parse'
from /home/johannes/Projects/crystal-lang/crystal/lib/markd/src/markd/parsers/block.cr:6:7 in 'parse'
from /home/johannes/Projects/crystal-lang/crystal/lib/markd/src/markd/parser.cr:4:7 in 'parse'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/tools/doc/generator.cr:321:5 in 'render_markdown'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/tools/doc/generator.cr:315:5 in 'doc'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/tools/doc/generator.cr:305:5 in 'doc'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/tools/doc/item.cr:3:5 in 'formatted_doc'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/tools/doc/html/type.html:30:7 in 'to_s'
from /home/johannes/Projects/crystal-lang/crystal/src/io.cr:174:5 in '<<'
from /home/johannes/Projects/crystal-lang/crystal/src/io.cr:188:5 in 'print'
from /home/johannes/Projects/crystal-lang/crystal/src/file.cr:717:9 in 'write'
from /home/johannes/Projects/crystal-lang/crystal/src/file.cr:709:3 in 'write'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/tools/doc/generator.cr:118:7 in 'generate_types_docs'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/tools/doc/generator.cr:124:9 in 'generate_types_docs'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/tools/doc/generator.cr:78:5 in 'generate_docs_html'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/tools/doc/generator.cr:46:7 in 'run'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/command/docs.cr:141:5 in 'docs'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/command.cr:90:7 in 'run'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/command.cr:49:5 in 'run'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal/command.cr:48:3 in 'run'
from /home/johannes/Projects/crystal-lang/crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
from /home/johannes/Projects/crystal-lang/crystal/src/crystal/main.cr:110:5 in 'main_user_code'
from /home/johannes/Projects/crystal-lang/crystal/src/crystal/main.cr:96:7 in 'main'
from /home/johannes/Projects/crystal-lang/crystal/src/crystal/main.cr:119:3 in 'main'
from __libc_start_main
from _start
from ???
This is the current value of @text
when the error occurs:
start_pos
is 13 and opener.index
is 83, which results in a negative difference.
A quick fix is to avoid the exception by checking if the slice size is negative. ref_label
would stay nil
in that case, and it allows the doc generator to complete.
/cc @icyleaf Any ideas?
...and it's already been fixed: https://github.com/icyleaf/markd/pull/43 Thanks @icyleaf!
I'll pull in the upstream changes.
markd 0.4.2 was out.
Using
crystal docs
on https://github.com/GeopJr/libadwaita.cr, exits with the following (and without finishing generating the docs of course):Error
Environment
Reproduction
git clone https://github.com/GeopJr/libadwaita.cr
cd libadwaita.cr
shards install
crystal docs
This doesn't happen on version
1.1.1