Skip to content

struct Crystal::TypeDeclarationProcessor
inherits Struct

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.

Class methods

.new(program : Program)

View source

Methods

#check_non_nilable_class_vars_without_initializers

View source

#process(node)

View source