Goose  Diff

Differences From Artifact [162dde70ac]:

  • File bs/sema/overloadset.cpp — 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: 1241)

To Artifact [b11838e702]:

  • File bs/sema/overloadset.cpp — part of check-in [7bb051b826] at 2021-09-24 19:11:17 on branch trunk — Overload resolution: cache which overload was selected for a given argument tuple (user: achavasse size: 1697)

1
2

3
4
5
6
7
8
9
#include "builtins/builtins.h"


using namespace goose::sema;

bool OverloadSet::add( const Env& e, const Value& callee )
{
    auto pInvRule = GetInvocationRule( e, callee );
    assert( pInvRule );
    return add( e, callee, pInvRule );


>







1
2
3
4
5
6
7
8
9
10
#include "builtins/builtins.h"

using namespace goose;
using namespace goose::sema;

bool OverloadSet::add( const Env& e, const Value& callee )
{
    auto pInvRule = GetInvocationRule( e, callee );
    assert( pInvRule );
    return add( e, callee, pInvRule );
44
45
46
47
48
49
50



















    for( auto&& [callVec,uniCallVec,ovl,tcc] : m_trie->typeCheck( *callDecomp->get(), tcc ) )
    {
        auto uniCall = TERM( make_shared< Vector >( uniCallVec ) );
        co_yield { move( uniCall ), ovl, tcc };
    }
}

























>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

    for( auto&& [callVec,uniCallVec,ovl,tcc] : m_trie->typeCheck( *callDecomp->get(), tcc ) )
    {
        auto uniCall = TERM( make_shared< Vector >( uniCallVec ) );
        co_yield { move( uniCall ), ovl, tcc };
    }
}

optional< OverloadSet::Overload > OverloadSet::getResolutionFromCache( const Term& args ) const
{
    ProfileZoneScoped;

    for( auto&& [_,ovl] : Match( args, m_resolutionCache ) )
        return ovl;

    return nullopt;
}

void OverloadSet::addResolutionToCache( const Term& args, const Overload& ovl )
{
    ProfileZoneScoped;

    m_resolutionCache = Merge( m_resolutionCache, args,
        [&]( auto&& ) { return ovl; } );
}