struct Crystal::TypeDeclarationProcessor

Overview

Here we mix the result of explicit type declarations for global, class and instance variables with the implicit types guessed from assignments to them.

If a type is explicit, the guess is not used (it might later give a compile error on incompatible types, on MainVisitor).

If the type of an instance variable is implicit a bit more logic is involved since we need to check if a variable is assigned in all of the initialize methods, or if the initializers are defined in a superclass, if super is called, etc.

Defined in:

crystalline/ext/compiler.cr