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

Compiler crash when autofilled array assigns instance variable in class without type reference #6091

Closed
SlayerShadow opened this issue May 12, 2018 · 1 comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler

Comments

@SlayerShadow
Copy link

Similar to #2665 scope.

class Foo
  def some_action
    @value = Array.new( 64 ){ 64 }
  end
end

Raises compiler error (will be shown below). But other declarations works correctly:

  1. value = Array.new( 64 ){ 64 } - all ok (out of class or local variable).
  2. class Foo
      def some_action
        value = Array.new( 64 ){ 64 }
      end
    end
    All ok (local variable).
  1. class Foo
      def bar
        @value = Array( Int32 ).new( 64 ){ 64 }
      end
    end
    All ok (type reference).
$ crystal -v
Crystal 0.24.2 [4f9ed8d03] (2018-03-08)

LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu
$ uname -a
Linux pc 4.16.0-1-amd64 #1 SMP Debian 4.16.5-1 (2018-04-29) x86_64 GNU/Linux

Error:

cast from Nil to Crystal::GenericInstanceType+ failed, at /crystal/src/compiler/crystal/types.cr:1428:20:1428
???
...
???
Error: you've found a bug in the Crystal compiler.

Backtrace is filled by "?" signs, and nothing helped to display it.

@jhass jhass added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler labels May 12, 2018
@asterite
Copy link
Member

Duplicate of #5383

@asterite asterite marked this as a duplicate of #5383 May 23, 2018
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
Projects
None yet
Development

No branches or pull requests

3 participants