These are chat archives for f/kamber

17th
Aug 2016
Renich Bon Ciric
@renich
Aug 17 2016 23:35
Guys, I am getting an error

crystal build --release src/kamber.cr
Error in ./libs/kemal/kemal.cr:39: instantiating 'Kemal:Module#run()'

Kemal.run if Kemal.config.run
^~~

in ./libs/kemal/kemal.cr:6: instantiating 'Kemal::CLI:Class#new()'

Kemal::CLI.new
           ^~~

instantiating 'Kemal::CLI#initialize()'

in ./libs/kemal/kemal/cli.cr:7: Can't infer the type of instance variable '@key_file' of Kemal::CLI

The type of a instance variable, if not declared explicitly with
@key_file : Type, is inferred from assignments to it across
the whole program.

The assignments must look like this:

  1. @key_file = 1 (or other literals), inferred to the literal's type
  2. @key_file = Type.new, type is inferred to be Type
  3. @key_file = Type.method, where method has a return type
    annotation, type is inferred from it
  4. @key_file = arg, with 'arg' being a method argument with a
    type restriction 'Type', type is inferred to be Type
  5. @key_file = arg, with 'arg' being a method argument with a
    default value, type is inferred using rules 1, 2 and 3 from it
  6. @key_file = uninitialized Type, type is inferred to be Type
  7. @key_file = LibSome.func, and LibSome is a lib, type
    is inferred from that fun.
  8. LibSome.func(out @key_file), and LibSome is a lib, type
    is inferred from that fun argument.

Other assignments have no effect on its type.

Can't infer the type of instance variable '@key_file' of Kemal::CLI

  @key_file = nil
  ^~~~~~~~~
$ crystal build --release src/kamber.cr 
Error in ./libs/kemal/kemal.cr:39: instantiating 'Kemal:Module#run()'

  Kemal.run if Kemal.config.run
        ^~~

in ./libs/kemal/kemal.cr:6: instantiating 'Kemal::CLI:Class#new()'

    Kemal::CLI.new
               ^~~

instantiating 'Kemal::CLI#initialize()'

in ./libs/kemal/kemal/cli.cr:7: Can't infer the type of instance variable '@key_file' of Kemal::CLI

The type of a instance variable, if not declared explicitly with
`@key_file : Type`, is inferred from assignments to it across
the whole program.

The assignments must look like this:

  1. `@key_file = 1` (or other literals), inferred to the literal's type
  2. `@key_file = Type.new`, type is inferred to be Type
  3. `@key_file = Type.method`, where `method` has a return type
     annotation, type is inferred from it
  4. `@key_file = arg`, with 'arg' being a method argument with a
     type restriction 'Type', type is inferred to be Type
  5. `@key_file = arg`, with 'arg' being a method argument with a
     default value, type is inferred using rules 1, 2 and 3 from it
  6. `@key_file = uninitialized Type`, type is inferred to be Type
  7. `@key_file = LibSome.func`, and `LibSome` is a `lib`, type
     is inferred from that fun.
  8. `LibSome.func(out @key_file)`, and `LibSome` is a `lib`, type
     is inferred from that fun argument.

Other assignments have no effect on its type.

Can't infer the type of instance variable '@key_file' of Kemal::CLI

      @key_file = nil
      ^~~~~~~~~