Goose  Artifact [892b018554]

Artifact 892b01855453520c9fc0bc5131b315286d25b8d40b9a27ed30ccfc80db25b5e9:

  • File bs/sema/typecheck.h — part of check-in [46e87c202b] at 2021-08-28 17:55:26 on branch trunk —
    • Instead of falling back to unification as the default type checking rule, implemented default type checking rules similar to the default unification ones
    • Fixed a nasty generator bug
    • Fixed reference type parsing not generating a location
    • Fixed where operator not generating a location that spanned both the types and the predicates
    • Various fixes to accomodate random api changes in the latest llvm
    • Updates fmt and catch2 versions
    (user: achavasse size: 755)

#ifndef GOOSE_SEMA_TYPECHECK_H
#define GOOSE_SEMA_TYPECHECK_H

namespace goose::sema
{
    struct NoUnification {};
    struct AmbiguousTypeCheck {};
    using TCSol = pair< Term, TypeCheckingContext >;

    using TypeCheckingSolution = variant
    <
        NoUnification,
        AmbiguousTypeCheck,
        TCSol
    >;

    TypeCheckingSolution FindBestTyping( const Term& lhs, const Term& rhs, const Context& context );

    using TCGen = Generator< pair< Term, TypeCheckingContext > >;

    TCGen TypeCheck( const Term& lhs, const Term& rhs, const TypeCheckingContext& tcc );

    TCGen Unify( const Term& lhs, const Term& rhs, const TypeCheckingContext& tcc );
    optional< Term > HalfUnify( const Term& lhs, TypeCheckingContext& tcc );
}

#endif