Goose  Diff

Differences From Artifact [7c4608b6e1]:

  • File bs/builtins/operators/helpers.h — part of check-in [4d4d76607a] at 2023-03-05 22:24:05 on branch trunk —
    • removed fmtlib, now use std::format
    • vastly improved the overload resolution debugging tools
    • prelude: started adding some extra error detection for small things that don't need to be builtin
    • prelude: started working on implementing #for for tuples, some stuff needs to be addressed still
    • fixed some type checking issue with wrapped args
    • fixed superfluous nested lifetime scope in brace blocks (which caused redundant calls to some extension points)
    (user: zlodo size: 4584)

To Artifact [6f0bef6485]:

  • File bs/builtins/operators/helpers.h — part of check-in [f605c7c4a3] at 2023-08-25 18:44:59 on branch trunk — Some cleanup in preparation for getting rid of proposition lists (user: zlodo size: 4470)

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
            DiagnosticsContext dc( 0, format( "When invoking {}.", funcName.str() ) );
            return InvokeOverloadSet( p.context(), pOvlSet, MakeClosedTuple( forward< O >( operands )... ),
                p.context().locationId() );
        };
    }

    template< typename T, typename I, typename RT = T >
    auto ForType( source_location sloc = source_location::current() )
    {
        return [sloc]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
        {
            using intrinsicType = Intrinsic< Value ( T, T ) >;
            auto intrinsicFunc = []( const Context& c, const Value& lhs, const Value& rhs )
            {
                return BuildComputedValue( GetValueType< RT >(), lhs, rhs, I( ( c.locationId() ) ) );
            };

            auto loc = Location::Create( sloc );
            pOvlSet->add( e, ToValue< intrinsicType >( move( intrinsicFunc ) ).setLocationId( loc ),
                GetBuiltinIntrinsicFuncInvocationRule() );
        };
    }

    template< typename T, typename F >
    auto ForType( F&& func, source_location sloc = source_location::current() )
    {
        return [&,sloc]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
        {
            auto loc = Location::Create( sloc );
            if constexpr( is_same_v< tag, UnaryOpTag > )
            {
                using intrinsicType = Intrinsic< Value ( T ) >;
                pOvlSet->add( e, ToValue< intrinsicType >( forward< F >( func ) ).setLocationId( loc ),
                    GetBuiltinIntrinsicFuncInvocationRule() );
            }
            else
            {
                using intrinsicType = Intrinsic< Value ( T, T ) >;
                pOvlSet->add( e, ToValue< intrinsicType >( forward< F >( func ) ).setLocationId( loc ),
                    GetBuiltinIntrinsicFuncInvocationRule() );
            }
        };
    }

    template< typename T1, typename T2, typename F >
    auto ForTypes( F&& func, source_location sloc = source_location::current() )
    {
        return [=]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
        {
            using intrinsicType = Intrinsic< Value ( T1, T2 ) >;
            auto loc = Location::Create( sloc );
            pOvlSet->add( e, ToValue< intrinsicType >( func ).setLocationId( loc ),
                GetBuiltinIntrinsicFuncInvocationRule() );
        };
    }
}

#endif







|
















|




















|












66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
            DiagnosticsContext dc( 0, format( "When invoking {}.", funcName.str() ) );
            return InvokeOverloadSet( p.context(), pOvlSet, MakeClosedTuple( forward< O >( operands )... ),
                p.context().locationId() );
        };
    }

    template< typename T, typename I, typename RT = T >
    auto ForType( CURRENT_LOC )
    {
        return [sloc]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
        {
            using intrinsicType = Intrinsic< Value ( T, T ) >;
            auto intrinsicFunc = []( const Context& c, const Value& lhs, const Value& rhs )
            {
                return BuildComputedValue( GetValueType< RT >(), lhs, rhs, I( ( c.locationId() ) ) );
            };

            auto loc = Location::Create( sloc );
            pOvlSet->add( e, ToValue< intrinsicType >( move( intrinsicFunc ) ).setLocationId( loc ),
                GetBuiltinIntrinsicFuncInvocationRule() );
        };
    }

    template< typename T, typename F >
    auto ForType( F&& func, CURRENT_LOC )
    {
        return [&,sloc]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
        {
            auto loc = Location::Create( sloc );
            if constexpr( is_same_v< tag, UnaryOpTag > )
            {
                using intrinsicType = Intrinsic< Value ( T ) >;
                pOvlSet->add( e, ToValue< intrinsicType >( forward< F >( func ) ).setLocationId( loc ),
                    GetBuiltinIntrinsicFuncInvocationRule() );
            }
            else
            {
                using intrinsicType = Intrinsic< Value ( T, T ) >;
                pOvlSet->add( e, ToValue< intrinsicType >( forward< F >( func ) ).setLocationId( loc ),
                    GetBuiltinIntrinsicFuncInvocationRule() );
            }
        };
    }

    template< typename T1, typename T2, typename F >
    auto ForTypes( F&& func, CURRENT_LOC )
    {
        return [=]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
        {
            using intrinsicType = Intrinsic< Value ( T1, T2 ) >;
            auto loc = Location::Create( sloc );
            pOvlSet->add( e, ToValue< intrinsicType >( func ).setLocationId( loc ),
                GetBuiltinIntrinsicFuncInvocationRule() );
        };
    }
}

#endif