Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 28a6f06a4b5b
Choose a base ref
...
head repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e0ac47cf657e
Choose a head ref
  • 3 commits
  • 5 files changed
  • 1 contributor

Commits on Nov 23, 2016

  1. Fixed #3568: incorrect links for ::T paths in comments

    Ary Borenszweig committed Nov 23, 2016
    Copy the full SHA
    b8602fb View commit details
  2. Fixed #3570: formatter bug related to binary op inside block inside a…

    …ssign
    Ary Borenszweig committed Nov 23, 2016
    Copy the full SHA
    69c8ee4 View commit details
  3. Fixed #3567: crystal init generates old version in shard.yml

    Ary Borenszweig committed Nov 23, 2016
    Copy the full SHA
    e0ac47c View commit details
2 changes: 2 additions & 0 deletions spec/compiler/formatter/formatter_spec.cr
Original file line number Diff line number Diff line change
@@ -981,4 +981,6 @@ describe Crystal::Formatter do
assert_format "1 +\n # foo\n 2"
assert_format "1 ||\n # foo\n 2"
assert_format "foo(1 ||\n # foo\n 2)"

assert_format "x = a do\n 1 ||\n 2\nend"
end
8 changes: 4 additions & 4 deletions src/compiler/crystal/tools/doc/markdown_doc_renderer.cr
Original file line number Diff line number Diff line change
@@ -46,9 +46,9 @@ class Crystal::Doc::MarkdownDocRenderer < Markdown::HTMLRenderer

# Check Type#method(...) or Type or #method(...)
text = text.gsub /\b
([A-Z]\w+(?:\:\:[A-Z]\w+)?(?:\#|\.)(?:\w|\<|\=|\>|\+|\-|\*|\/|\[|\]|\&|\||\?|\!|\^|\~)+(?:\?|\!)?(?:\(.+?\))?)
((?:\:\:)?[A-Z]\w+(?:\:\:[A-Z]\w+)?(?:\#|\.)(?:\w|\<|\=|\>|\+|\-|\*|\/|\[|\]|\&|\||\?|\!|\^|\~)+(?:\?|\!)?(?:\(.+?\))?)
|
([A-Z]\w+(?:\:\:[A-Z]\w+)?)
((?:\:\:)?[A-Z]\w+(?:\:\:[A-Z]\w+)?)
|
((?:\#|\.)(?:\w|\<|\=|\>|\+|\-|\*|\/|\[|\]|\&|\||\?|\!|\^|\~)+(?:\?|\!)?(?:\(.+?\))?)
/x do |match_text, match|
@@ -71,7 +71,7 @@ class Crystal::Doc::MarkdownDocRenderer < Markdown::HTMLRenderer
method_args = ""
end

another_type = @type.lookup_path(type_name.split("::"))
another_type = @type.lookup_path(type_name)
if another_type && @type.must_be_included?
method = lookup_method another_type, method_name, method_args, kind
if method
@@ -82,7 +82,7 @@ class Crystal::Doc::MarkdownDocRenderer < Markdown::HTMLRenderer

# Type
if match[2]?
another_type = @type.lookup_path(match_text.split("::"))
another_type = @type.lookup_path(match_text)
if another_type && another_type.must_be_included?
next type_link another_type, match_text
end
9 changes: 8 additions & 1 deletion src/compiler/crystal/tools/doc/type.cr
Original file line number Diff line number Diff line change
@@ -393,13 +393,20 @@ class Crystal::Doc::Type
@type.doc
end

def lookup_path(path_or_names)
def lookup_path(path_or_names : Path | Array(String))
match = @type.lookup_path(path_or_names)
return unless match.is_a?(Crystal::Type)

@generator.type(match)
end

def lookup_path(full_path : String)
global = full_path.starts_with?("::")
full_path = full_path[2..-1] if global
path = Path.new(full_path.split("::"), global: global)
lookup_path(path)
end

def lookup_method(name)
lookup_in_methods instance_methods, name
end
4 changes: 4 additions & 0 deletions src/compiler/crystal/tools/formatter.cr
Original file line number Diff line number Diff line change
@@ -2468,6 +2468,8 @@ module Crystal
def format_block(node, needs_space)
needs_comma = false
@dot_column = nil
old_inside_call_or_assign = @inside_call_or_assign
@inside_call_or_assign = 0

if @token.type == :","
needs_comma = true
@@ -2603,6 +2605,8 @@ module Crystal
raise "Bug: expected Call, IsA or RespondsTo as &. argument, at #{node.location}, not #{body.class}"
end
end

@inside_call_or_assign = old_inside_call_or_assign
end

def clear_object(node)
2 changes: 1 addition & 1 deletion src/compiler/crystal/tools/init/template/shard.yml.ecr
Original file line number Diff line number Diff line change
@@ -10,6 +10,6 @@ targets:
main: src/<%= config.name %>.cr
<%- end -%>

crystal: <%= Crystal::VERSION %>
crystal: <%= Crystal::Config.version %>

license: MIT