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

Fix GenericClassType vs GenericClassInstanceType restrictions #7537

Conversation

bew
Copy link
Contributor

@bew bew commented Mar 11, 2019

I can't find an issue this may have solved (hard to search!), but basically:

class Foo(T)
end

def bar(a : Foo)
  1
end

def bar(a : Foo(Int32))
  true
end

# Before:
bar(Foo(Int32).new) # => 1

# After
bar(Foo(Int32).new) # => true

🎉

@asterite
Copy link
Member

I'll review it tomorrow.

Copy link
Member

@asterite asterite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good! Thank you!

@asterite asterite added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler topic:compiler:semantic and removed topic:compiler labels Mar 12, 2019
@asterite asterite added this to the 0.28.0 milestone Mar 12, 2019
@asterite asterite merged commit 3cecde5 into crystal-lang:master Mar 12, 2019
@straight-shoota
Copy link
Member

@asterite Your announcement to review tomorrow would have been almost true in CET, just off by 2 minutes... 😆

@bew
Copy link
Contributor Author

bew commented Mar 13, 2019

Cool, thanks for the review and merge 😃

@bew bew deleted the bugfix/fix-GenericClassType-vs-GenericClassInstanceType-restrictions branch March 13, 2019 05:10
@asterite
Copy link
Member

@straight-shoota Haha, yes. I commented that but then realized I had time to do it then... but I figured maybe what I said is true in some timezone out there :-P

urde-graven pushed a commit to urde-graven/crystal that referenced this pull request Mar 20, 2019
* 'master' of github.com:crystal-lang/crystal:
  Change the font-weight used in Playground (crystal-lang#7552)
  Fix formatting absolute paths (crystal-lang#7560)
  Refactor IO::Syscall as IO::Evented (crystal-lang#7505)
  YAML: fix test checking serialization of slices for libyaml 0.2.2 (crystal-lang#7555)
  Let Array#sort only use `<=>`, and let `<=>` return `nil` for partial comparability (crystal-lang#6611)
  Update `to_s` and `inspect` to have similar signatures accross the stdlib (crystal-lang#7528)
  Fix restriction of valid type vs free vars (crystal-lang#7536)
  Rewrite macro spec without executing a shell command (crystal-lang#6962)
  Suggest `next` when trying to break from captured block  (crystal-lang#7406)
  Fix GenericClassType vs GenericClassInstanceType restrictions (crystal-lang#7537)
  Add human readable formatting for numbers (crystal-lang#6314)
  Add command and args to execvp error message (crystal-lang#7511)
  Implement Set#add? method (crystal-lang#7495)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants