10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
-
+
-
+
|
Value resolveInvocation( const Context& c, uint32_t loc, const Value& callee, const Term& args ) const final
{
optional< TypeCheckingContext > bestTCC;
optional< Term > bestSol;
bool ambiguous = false;
auto sig = GetFuncSig( callee );
auto callPat = VEC( args, HOLE( "_"_sid ) );
auto callPat = PrependToVectorTerm( args, HOLE( "_"_sid ) );
auto us = FindBestTyping( sig, callPat, c );
auto us = FindBestTypingVec( sig, callPat, c );
if( holds_alternative< NoUnification >( us ) )
{
// TODO display details
DiagnosticsManager::GetInstance().emitErrorMessage( loc,
"function arguments mismatch." );
return PoisonValue();
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
-
+
-
-
-
+
-
+
|
Value invoke( const Context& c, uint32_t loc, const Value& callee, const Term& args, const Term& unifiedCallPat, TypeCheckingContext& tcc ) const final
{
auto newCallee = prepareFunc( c, 0, callee, unifiedCallPat, tcc );
if( newCallee.isPoison() )
return PoisonValue();
auto callDecomp = Decompose( unifiedCallPat,
Vec(
Val< pvec >()
SubTerm(), // args
SubTerm() // return type
)
);
const auto& unifiedRType = callDecomp->get()->terms().front();
auto&& [unifiedArgs, unifiedRType] = *callDecomp;
auto unifiedArgs = DropVectorTerm( unifiedCallPat, 1 );
newCallee.setLocationId( loc );
if( IsBuiltinFunc( newCallee ) )
return BuildComputedValue( unifiedRType, cir::Call( newCallee, unifiedArgs ) );
if( IsIntrinsicFunc( newCallee ) )
|