Goose  Diff

Differences From Artifact [bc26afba9f]:

  • File bs/builtins/types/func/invoke.cpp — part of check-in [b8548d8b24] at 2019-08-11 17:18:45 on branch trunk —
    • Converted more error messages to the new system.
    • Propagated value locations in some missing places.
    • Added the location of template function calls as diagnostics context.
    (user: achavasse size: 4355)

To Artifact [96279e9453]:

  • File bs/builtins/types/func/invoke.cpp — part of check-in [59ecc02baa] at 2019-08-13 00:42:47 on branch trunk — Diagnostics: use value poisoning to (hopefully) fix most cases of superfluous cascading error messages. (user: achavasse size: 4431)

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
                }

                if( ambiguous )
                {
                    // TODO display details
                    DiagnosticsManager::GetInstance().emitErrorMessage( loc,
                        "ambiguous function call." );
                    return nullopt;
                }

                if( !bestSol )
                {
                    // TODO display details
                    DiagnosticsManager::GetInstance().emitErrorMessage( loc,
                        "function arguments mismatch." );
                    return nullopt;
                }

                return invoke( c, loc, callee, *bestSol, *bestUC );
            }

            optional< Value > invoke( const Context& c, uint32_t loc, const Value& callee, const Term& unifiedCallPat, UnificationContext& uc ) const final
            {







|







|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
                }

                if( ambiguous )
                {
                    // TODO display details
                    DiagnosticsManager::GetInstance().emitErrorMessage( loc,
                        "ambiguous function call." );
                    return PoisonValue();
                }

                if( !bestSol )
                {
                    // TODO display details
                    DiagnosticsManager::GetInstance().emitErrorMessage( loc,
                        "function arguments mismatch." );
                    return PoisonValue();
                }

                return invoke( c, loc, callee, *bestSol, *bestUC );
            }

            optional< Value > invoke( const Context& c, uint32_t loc, const Value& callee, const Term& unifiedCallPat, UnificationContext& uc ) const final
            {
92
93
94
95
96
97
98

99
100
101
102
103
104
105
            optional< Value > prepareFunc( const Context& c, const Value& callee, const Term& unifiedCallPat, UnificationContext& uc ) const final
            {
                if( IsBuiltinFunc( callee ) || IsIntrinsicFunc( callee ) )
                    return callee;

                // TODO better description with the function's name if possible (we may need to explicitely store it in the func)
                DiagnosticsContext dc( 0, true );


                return CompileFunc( c, callee );
            }
    };

    ptr< InvocationRule >& GetFuncInvocationRule()
    {







>







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
            optional< Value > prepareFunc( const Context& c, const Value& callee, const Term& unifiedCallPat, UnificationContext& uc ) const final
            {
                if( IsBuiltinFunc( callee ) || IsIntrinsicFunc( callee ) )
                    return callee;

                // TODO better description with the function's name if possible (we may need to explicitely store it in the func)
                DiagnosticsContext dc( 0, true );
                VerbosityContext vc( Verbosity::Normal, true );

                return CompileFunc( c, callee );
            }
    };

    ptr< InvocationRule >& GetFuncInvocationRule()
    {