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

BUG: cast from Nil to Crystal::GenericInstanceType+ #8031

Closed
ysbaddaden opened this issue Aug 2, 2019 · 0 comments · Fixed by #8035
Closed

BUG: cast from Nil to Crystal::GenericInstanceType+ #8031

ysbaddaden opened this issue Aug 2, 2019 · 0 comments · Fixed by #8035

Comments

@ysbaddaden
Copy link
Contributor

The following crashes Crystal 0.30.0, when it should report missing abstract methods. A workaround is to implement the abstract methods.

struct Foo
  include Indexable(Foo)
end
cast from Nil to Crystal::GenericInstanceType+ failed, at src/compiler/crystal/semantic/abstract_def_checker.cr:215:5:215 (TypeCastError)
  from src/compiler/crystal/semantic/abstract_def_checker.cr:0:5 in 'find_base_generic_instantiation'
  from src/compiler/crystal/semantic/abstract_def_checker.cr:129:7 in 'implements?'
  from src/compiler/crystal/semantic/abstract_def_checker.cr:104:12 in 'implements?'
  from src/compiler/crystal/semantic/abstract_def_checker.cr:95:7 in 'implements_with_ancestors?'
  from src/compiler/crystal/semantic/abstract_def_checker.cr:78:15 in 'check_implemented_in_subtypes'
  from src/compiler/crystal/semantic/abstract_def_checker.cr:64:5 in 'check_implemented_in_subtypes'
  from src/compiler/crystal/semantic/abstract_def_checker.cr:54:13 in 'check_single'
  from src/compiler/crystal/semantic/abstract_def_checker.cr:38:7 in 'check_types'
  from src/compiler/crystal/semantic/abstract_def_checker.cr:33:5 in 'run'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant