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

ivar initialized error with inherited double nested generic class #3635

Closed
maiha opened this issue Dec 4, 2016 · 0 comments
Closed

ivar initialized error with inherited double nested generic class #3635

maiha opened this issue Dec 4, 2016 · 0 comments

Comments

@maiha
Copy link
Contributor

maiha commented Dec 4, 2016

I expect instance variable @a is initialized, but got not initialized error in following code.

Real code

https://github.com/maiha/rocksdb.cr/blob/iteration/src/rocksdb/iterator.cr#L73

Minimum reproducible code

module Core(T)
  @a : Bool
end

class Base(T)
  include Core(Int32)

  def initialize
    @a = true
  end
end

Base(String).new  # OK                                                          

# This code fails
class Foo < Base(String)
end
# Error in test.cr:2: instance variable '@a' of Base(String) was not initialized
#  in all of the 'initialize' methods, rendering it nilable

versions

% crystal -v
Crystal 0.20.0 [b0cc6f7] (2016-11-22)

Got same error on master branch: Crystal 0.20.0+35 [eff31e5] (2016-12-04)

Best wishes,
maiha

@asterite asterite added this to the 0.20.1 milestone Dec 4, 2016
firejox pushed a commit to firejox/crystal that referenced this issue Dec 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants