Goose  Diff

Differences From Artifact [c9808b44ff]:

  • File bs/builtins/helpers.h — part of check-in [7d2def7b75] at 2020-12-27 14:40:24 on branch trunk — Renamed "ir" to "eir" (expression intermediate representation) and "llr" to "cir" (code intermediate representation) for clarity. (user: achavasse size: 2200)

To Artifact [778a4ecd6e]:

  • File bs/builtins/helpers.h — part of check-in [b2945b5bb1] at 2021-03-05 17:56:37 on branch trunk — Implemented refinement type predicate unification. Predicate violations by variable initialization are now properly detected. (user: achavasse size: 2184)

25
26
27
28
29
30
31
32

33
34
35
36
37
38

39
40
41
42
43
44
45

46
47
48
49
50
51

52
53
54
55
56
57
25
26
27
28
29
30
31

32
33
34
35
36
37

38
39
40
41
42
43
44

45
46
47
48
49
50

51
52
53
54
55
56
57







-
+





-
+






-
+





-
+






    variant< Value, ValUnifyError > ConvertValueToType( const Context& c, const Value& val, const Term& type );

    // Helpers to create a standard type construction, as a vector starting with an identity, followed by an optional pointer to predicates
    // and an optional pointer to a llvm type.
    template< typename I, typename... T >
    auto MkStdType( I&& identity, T&&... extra )
    {
        return VEC( forward< I >( identity ), TERM( ptr< void >() ), TERM( (void*)nullptr ), forward< T >( extra )... );
        return VEC( forward< I >( identity ), EmptyPredicates(), TERM( (void*)nullptr ), forward< T >( extra )... );
    }

    template< typename I >
    auto MkStdType( I&& identity )
    {
        return VEC( forward< I >( identity ), TERM( ptr< void >() ), TERM( (void*)nullptr ) );
        return VEC( forward< I >( identity ), EmptyPredicates(), TERM( (void*)nullptr ) );
    }

    // Same as above, but directly specify the llvm type pointer.
    template< typename I, typename L, typename... T >
    auto MkStdRTType( I&& identity, L&& llvmType, T&&... extra )
    {
        return VEC( forward< I >( identity ), TERM( ptr< void >() ), forward< L >( llvmType ), forward< T >( extra )... );
        return VEC( forward< I >( identity ), EmptyPredicates(), forward< L >( llvmType ), forward< T >( extra )... );
    }

    template< typename I, typename L >
    auto MkStdRTType( I&& identity, L&& llvmType )
    {
        return VEC( forward< I >( identity ), TERM( ptr< void >() ), forward< L >( llvmType ) );
        return VEC( forward< I >( identity ), EmptyPredicates(), forward< L >( llvmType ) );
    }

    extern pvec ParseExpressionList( parse::Parser& p, uint32_t precedence, const pvec& pVec = make_shared< Vector >() );
}

#endif