class Mint::TypeChecker
- Mint::TypeChecker
- Reference
- Object
Included Modules
Defined in:
type_checker.crtype_checker/artifacts.cr
type_checker/comparer.cr
type_checker/record.cr
type_checker/static_type_signature.cr
type_checker/type.cr
type_checker/variable.cr
type_checkers/access.cr
type_checkers/argument.cr
type_checkers/arguments.cr
type_checkers/array_literal.cr
type_checkers/await.cr
type_checkers/block.cr
type_checkers/bool_literal.cr
type_checkers/bracket_access.cr
type_checkers/builtin.cr
type_checkers/call.cr
type_checkers/case.cr
type_checkers/case_branch.cr
type_checkers/comment.cr
type_checkers/component.cr
type_checkers/connect.cr
type_checkers/constant.cr
type_checkers/css_definition.cr
type_checkers/css_font_face.cr
type_checkers/css_keyframes.cr
type_checkers/css_nested_at.cr
type_checkers/css_selector.cr
type_checkers/dbg.cr
type_checkers/decode.cr
type_checkers/defer.cr
type_checkers/destructuring.cr
type_checkers/directives/asset.cr
type_checkers/directives/format.cr
type_checkers/directives/highlight.cr
type_checkers/directives/highlight_file.cr
type_checkers/directives/inline.cr
type_checkers/directives/svg.cr
type_checkers/emit.cr
type_checkers/encode.cr
type_checkers/env.cr
type_checkers/field.cr
type_checkers/field_access.cr
type_checkers/for_expression.cr
type_checkers/function.cr
type_checkers/get.cr
type_checkers/here_document.cr
type_checkers/html_attribute.cr
type_checkers/html_component.cr
type_checkers/html_content.cr
type_checkers/html_element.cr
type_checkers/html_fragment.cr
type_checkers/html_style.cr
type_checkers/if.cr
type_checkers/inline_function.cr
type_checkers/interpolation.cr
type_checkers/js.cr
type_checkers/locale.cr
type_checkers/locale_key.cr
type_checkers/map.cr
type_checkers/module.cr
type_checkers/negated_expression.cr
type_checkers/next_call.cr
type_checkers/number_literal.cr
type_checkers/operation.cr
type_checkers/parenthesized_expression.cr
type_checkers/pipe.cr
type_checkers/property.cr
type_checkers/provider.cr
type_checkers/record.cr
type_checkers/record_update.cr
type_checkers/regexp_literal.cr
type_checkers/return_call.cr
type_checkers/route.cr
type_checkers/routes.cr
type_checkers/signal.cr
type_checkers/state.cr
type_checkers/state_setter.cr
type_checkers/statement.cr
type_checkers/store.cr
type_checkers/string_literal.cr
type_checkers/style.cr
type_checkers/suite.cr
type_checkers/test.cr
type_checkers/top_level.cr
type_checkers/tuple_literal.cr
type_checkers/type.cr
type_checkers/type_definition.cr
type_checkers/type_definition_field.cr
type_checkers/type_variable.cr
type_checkers/type_variant.cr
type_checkers/unary_minus.cr
type_checkers/use.cr
type_checkers/variable.cr
Constant Summary
-
ARRAY =
Type.new("Array", [Variable.new("a")] of Checkable)
-
BOOL =
Type.new("Bool")
-
BOOL_PROMISE =
Type.new("Promise", [BOOL] of Checkable)
-
CSS_PROPERTY_NAMES =
{{ (read_file("/srv/crystaldoc.info/github-mint-lang-mint-0.20.1/src/type_checkers/../assets/css_properties")).strip.lines }}
-
EVENT =
Type.new("Html.Event")
-
EVENT_FUNCTION =
Type.new("Function", [EVENT, Variable.new("a")] of Checkable)
-
EXPOSED_BUILTINS =
["decodeBoolean", "decodeNumber", "decodeString", "decodeArray", "decodeField", "decodeMaybe", "decodeTime", "locale", "normalizeEvent", "createPortal", "testContext", "testRender", "setLocale", "navigate", "compare", "nothing", "just", "err", "ok"] of ::String
-
HTML =
Type.new("Html")
-
HTML_CHILDREN =
Type.new("Array", [HTML] of Checkable)
-
MAP =
Type.new("Map", [Variable.new("a"), Variable.new("b")] of Checkable)
-
MAYBE =
Type.new("Maybe", [Variable.new("a")] of Checkable)
-
MAYBE_PROMISE =
Type.new("Promise", [MAYBE] of Checkable)
-
NUMBER =
Type.new("Number")
-
NUMBER_CHILDREN =
Type.new("Array", [NUMBER] of Checkable)
-
OBJECT =
Type.new("Object")
-
OBJECT_ERROR =
Type.new("Object.Error")
-
REGEXP =
Type.new("Regexp")
-
RESERVED =
["break", "case", "class", "const", "continue", "debugger", "default", "do", "else", "export", "extends", "for", "if", "import", "in", "instanceof", "new", "return", "super", "switch", "throw", "typeof", "var", "while", "yield"] of ::String
-
RESULT =
Type.new("Result", [Variable.new("a"), Variable.new("b")] of Checkable)
-
SET =
Type.new("Set", [Variable.new("a")] of Checkable)
-
STRING =
Type.new("String")
-
STYLE_MAP =
Type.new("Map", [STRING, STRING] of Checkable)
-
TEST_CONTEXT =
Type.new("Test.Context", [Variable.new("a")] of Checkable)
-
TEST_PROMISE =
Type.new("Promise", [TEST_CONTEXT] of Checkable)
-
TEXT_CHILDREN =
Type.new("Array", [STRING] of Checkable)
-
TIME =
Type.new("Time")
-
VALID_HTML =
[NUMBER_CHILDREN, TEXT_CHILDREN, HTML_CHILDREN, NUMBER, STRING, HTML] of Checkable
-
VALID_IF_TYPES =
[MAYBE_PROMISE, VOID_PROMISE, STRING, ARRAY, MAYBE, VOID, HTML] of Checkable
-
VALID_TEST_TYPES =
[TEST_PROMISE, TEST_CONTEXT, BOOL_PROMISE, BOOL] of Checkable
-
VOID =
Type.new("Void")
-
VOID_FUNCTION =
Type.new("Function", [Variable.new("a")] of Checkable)
-
VOID_PROMISE =
Type.new("Promise", [VOID] of Checkable)
Constructors
Class Method Summary
Instance Method Summary
- #add_record(record : Record, node)
- #add_record(record, node)
- #artifacts : Mint::TypeChecker::Artifacts
- #assets(*args, **options)
- #assets(*args, **options, &)
- #ast(*args, **options)
- #ast(*args, **options, &)
- #async(*args, **options)
- #async(*args, **options, &)
- #block
- #cache(*args, **options)
- #cache(*args, **options, &)
- #check(parameters : Array(Ast::Node), names : Array(Ast::TypeVariable), used_parameters : Set(Ast::TypeVariable))
- #check(node : Ast::CaseBranch, condition : Checkable) : Checkable
- #check(node : Ast::HtmlAttribute, element : Ast::HtmlFragment) : Checkable
- #check(node : Ast::HtmlAttribute, element : Ast::HtmlElement) : Checkable
- #check(node : Ast::HtmlAttribute, component : Ast::Component) : Checkable
-
#check(node : Ast::Access) : Checkable
Maybe.Just -> Type Variant Maybe.isJust -> Entity function Html.Event.ADD -> Entity Constant (() { { a: "B" }}).a -> Record access
- #check(node : Ast::Argument) : Checkable
- #check(node : Ast::ArrayLiteral) : Checkable
- #check(node : Ast::Await) : Checkable
- #check(node : Ast::Block) : Checkable
- #check(node : Ast::BoolLiteral) : Checkable
- #check(node : Ast::BracketAccess) : Checkable
- #check(node : Ast::Builtin) : Checkable
- #check(node : Ast::Call)
- #check(node : Ast::Case) : Checkable
- #check(node : Ast::Comment) : Checkable
- #check(node : Ast::Component) : Checkable
- #check(node : Ast::Connect) : Checkable
- #check(node : Ast::Constant) : Checkable
- #check(node : Ast::CssDefinition) : Checkable
- #check(node : Ast::CssFontFace) : Checkable
- #check(node : Ast::CssKeyframes) : Checkable
- #check(node : Ast::CssNestedAt) : Checkable
- #check(node : Ast::CssSelector) : Checkable
- #check(node : Ast::Dbg) : Checkable
- #check(node : Ast::Decode) : Checkable
- #check(node : Ast::Defer) : Checkable
- #check(node : Ast::Emit) : Checkable
- #check(node : Ast::Encode) : Checkable
- #check(node : Ast::Env) : Checkable
- #check(node : Ast::Field, should_create_record : Bool = false) : Checkable
- #check(node : Ast::FieldAccess) : Checkable
- #check(node : Ast::For) : Checkable
- #check(node : Ast::Function)
- #check(node : Ast::Get) : Checkable
- #check(node : Ast::HereDocument) : Checkable
- #check(node : Ast::HtmlComponent) : Checkable
- #check(node : Ast::HtmlElement) : Checkable
- #check(node : Ast::HtmlFragment) : Checkable
- #check(node : Ast::HtmlStyle) : Checkable
- #check(node : Ast::If) : Checkable
- #check(node : Ast::InlineFunction)
- #check(node : Ast::Interpolation) : Checkable
- #check(node : Ast::Js) : Checkable
- #check(node : Ast::LocaleKey) : Checkable
- #check(node : Ast::Map) : Checkable
- #check(node : Ast::Module) : Checkable
- #check(node : Ast::NegatedExpression) : Checkable
- #check(node : Ast::NextCall) : Checkable
- #check(node : Ast::NumberLiteral) : Checkable
- #check(node : Ast::Operation) : Checkable
- #check(node : Ast::ParenthesizedExpression) : Checkable
- #check(node : Ast::Pipe) : Checkable
- #check(node : Ast::Property) : Checkable
- #check(node : Ast::Provider) : Checkable
- #check(node : Ast::Record, should_create_record : Bool = false) : Checkable
- #check(node : Ast::RecordUpdate) : Checkable
- #check(node : Ast::RegexpLiteral) : Checkable
- #check(node : Ast::ReturnCall) : Checkable
- #check(node : Ast::Route) : Checkable
- #check(node : Ast::Routes) : Checkable
- #check(node : Ast::Signal) : Checkable
- #check(node : Ast::State) : Checkable
- #check(node : Ast::StateSetter) : Checkable
- #check(node : Ast::Statement) : Checkable
- #check(node : Ast::Store) : Checkable
- #check(node : Ast::StringLiteral) : Checkable
- #check(node : Ast::Style) : Checkable
- #check(node : Ast::Suite)
- #check(node : Ast::Test)
- #check(node : Ast) : Checkable
- #check(node : Ast::TupleLiteral) : Checkable
- #check(node : Ast::Type) : Checkable
- #check(node : Ast::TypeDefinition) : Checkable
- #check(node : Ast::TypeDefinitionField) : Checkable
- #check(node : Ast::TypeVariable) : Checkable
- #check(node : Ast::TypeVariant) : Checkable
- #check(node : Ast::UnaryMinus) : Checkable
- #check(node : Ast::Use) : Checkable
- #check(node : Ast::Variable) : Checkable
- #check(node : Ast::Directives::Asset) : Checkable
- #check(node : Ast::Directives::Format) : Checkable
- #check(node : Ast::Directives::Highlight) : Checkable
- #check(node : Ast::Directives::HighlightFile) : Checkable
- #check(node : Ast::Directives::Inline) : Checkable
- #check(node : Ast::Directives::Svg) : Checkable
- #check(node : Checkable) : Checkable
- #check(nodes : Array(Ast::Node)) : Array(Checkable)
- #check(node : Ast::Node) : Checkable
- #check : Artifacts
- #check!(node)
-
#check_all(node : Ast::Component) : Checkable
Check all nodes that were not checked before
- #check_all(node : Ast::Module) : Checkable
- #check_all(nodes : Array(Ast::Node)) : Array(Checkable)
- #check_arguments(arguments : Array(Ast::Argument))
- #check_call(node, function_type) : Checkable
- #check_decode(type : Checkable)
- #check_everything? : Bool
- #check_exhaustiveness(target : Checkable, patterns : Array(Ast::Node | Nil))
- #check_function(node : Ast::Function | Ast::InlineFunction) : Checkable
- #check_global_names(name : String, node : Ast::Node) : Nil
- #check_html(nodes : Array(Ast::Node)) : Checkable
- #check_locale(node : Ast::Locale)
- #check_locale_record(*, language : String, node : Ast::Field, prefix : String | Nil)
- #check_names(nodes : Array(Ast::Function | Ast::Get | Ast::Property | Ast::State | Ast::Signal), error : String, resolved = {} of String => Ast::Node) : Nil
- #checked(*args, **options)
- #checked(*args, **options, &)
- #checking=(checking : Bool)
- #checking? : Bool
- #component_records(*args, **options)
- #component_records(*args, **options, &)
- #components_touched(*args, **options)
- #components_touched(*args, **options, &)
- #create_record(fields)
- #destructure(node : Nil, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
- #destructure(node : Ast::Discard, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
-
#destructure(node : Ast::Variable, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
This is for the
let
statement when it's a single assignment - #destructure(node : Ast::ArrayDestructuring, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
- #destructure(node : Ast::TupleDestructuring, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
- #destructure(node : Ast::TypeDestructuring, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
- #destructure(node : Ast::Node, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
- #destructuring_type_mismatch(expected : Checkable, got : Checkable, node : Ast::Node)
- #format(*args, **options)
- #format(*args, **options, &)
- #formatter : Mint::Formatter
- #global_name_conflict(other : Ast::Node, node : Ast::Node, what : String, name : String)
-
#here_doc_interpolation_type_mismatch(*, node : Ast::Node, type : Checkable, got : Checkable)
TODO Show all possible types that can be...
- #invalid_self_reference(referee : Ast::Node, node : Ast::Node)
- #locales(*args, **options)
- #locales(*args, **options, &)
- #lookup(node : Ast::Variable)
- #lookup_with_level(node : Ast::Variable)
- #lookups(*args, **options)
- #lookups(*args, **options, &)
- #operation_bool_type_mismatch(value : TypeChecker::Checkable, operator : String, node : Ast::Node, side : String)
- #operation_numeric_type_mismatch(value : TypeChecker::Checkable, operator : String, node : Ast::Node, side : String)
- #operation_plus_type_mismatch(value : TypeChecker::Checkable, node : Ast::Node, side : String)
- #operation_type_mismatch(right : TypeChecker::Checkable, left : TypeChecker::Checkable, node : Ast::Node)
- #ordinal(number)
- #print_stack
- #record_field_lookup(*args, **options)
- #record_field_lookup(*args, **options, &)
- #records : Array(Mint::TypeChecker::Record)
- #references(*args, **options)
- #references(*args, **options, &)
- #resolve(nodes : Array(Ast::Node)) : Array(Checkable)
- #resolve(node : Ast::Node | Checkable, *args) : Checkable
- #resolve(nodes : Array(Ast::Node), *args) : Array(Checkable)
- #resolve_order(*args, **options)
- #resolve_order(*args, **options, &)
- #resolve_record_definition(name)
- #resolve_records
- #resolve_type(node : Record | Variable)
- #resolve_type(node : Type)
- #scope(*args, **options)
- #scope(*args, **options, &)
-
#static_type_signature(node) : Checkable
This method computes the static type signature of an entity.
- #to_function_type(node : Ast::TypeVariant, parent : Ast::TypeDefinition)
- #to_pattern(node : Ast::ArrayDestructuring) : ExhaustivenessChecker::Pattern
- #to_pattern(node : Ast::TupleDestructuring) : ExhaustivenessChecker::Pattern
- #to_pattern(node : Ast::TypeDestructuring) : ExhaustivenessChecker::Pattern
- #to_pattern(node : Ast::Spread) : ExhaustivenessChecker::Pattern
- #to_pattern(node : Ast::Variable) : ExhaustivenessChecker::Pattern
- #to_pattern(node : Ast::Discard) : ExhaustivenessChecker::Pattern
- #to_pattern(node : Ast::Node) : ExhaustivenessChecker::Pattern
- #to_pattern(node : Nil) : ExhaustivenessChecker::Pattern
- #to_pattern_type(node : Ast::Node) : ExhaustivenessChecker::Checkable
- #to_pattern_type(type : Checkable) : ExhaustivenessChecker::Checkable
- #track_references(node)
- #trackable?(node : Ast::Node)
- #unwind_access(node : Ast::Access, stack = [] of Ast::Variable) : Array(Ast::Variable)
- #variables(*args, **options)
- #variables(*args, **options, &)
- #with_restricted_top_level_entity(referee : Mint::Ast::Node | Nil, &)
Instance methods inherited from module Mint::Helpers
owns?(node : Ast::Node, parent : Ast::Node) : Bool
owns?,
static?(nodes : Array(Ast::Node)) : Boolstatic?(node : Ast::Node | Nil) : Bool static?, static_value(nodes : Array(Ast::Node), separator : Char | Nil = nil) : String
static_value(node : Ast::Node | Nil) : String | Nil static_value
Instance methods inherited from module Mint::Errorable
error!(name : Symbol, &)
error!,
unreachable!(message : String)
unreachable!
Constructor Detail
Class Method Detail
Instance Method Detail
def check(parameters : Array(Ast::Node), names : Array(Ast::TypeVariable), used_parameters : Set(Ast::TypeVariable))
#
Maybe.Just -> Type Variant Maybe.isJust -> Entity function Html.Event.ADD -> Entity Constant (() { { a: "B" }}).a -> Record access
Check all nodes that were not checked before
def check_names(nodes : Array(Ast::Function | Ast::Get | Ast::Property | Ast::State | Ast::Signal), error : String, resolved = {} of String => Ast::Node) : Nil
#
def destructure(node : Nil, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
#
def destructure(node : Ast::Discard, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
#
def destructure(node : Ast::Variable, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
#
This is for the let
statement when it's a single assignment
def destructure(node : Ast::ArrayDestructuring, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
#
def destructure(node : Ast::TupleDestructuring, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
#
def destructure(node : Ast::TypeDestructuring, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
#
def destructure(node : Ast::Node, condition : Checkable, variables : Array(VariableScope) = [] of VariableScope)
#
TODO Show all possible types that can be...
def operation_bool_type_mismatch(value : TypeChecker::Checkable, operator : String, node : Ast::Node, side : String)
#
def operation_numeric_type_mismatch(value : TypeChecker::Checkable, operator : String, node : Ast::Node, side : String)
#
def operation_type_mismatch(right : TypeChecker::Checkable, left : TypeChecker::Checkable, node : Ast::Node)
#
This method computes the static type signature of an entity.