Goose  Diff

Differences From Artifact [74bf0712de]:

  • File bs/sema/tc-context.h — part of check-in [95bdac72ca] at 2022-07-05 22:10:27 on branch trunk — TypeChecking: keep track of nested repetition indices for each sub context (user: zlodo size: 5909)

To Artifact [d14dbc5094]:

  • File bs/sema/tc-context.h — part of check-in [a2a6841c8b] at 2022-07-18 00:14:42 on branch trunk — Keep track of the repetition depth of pack TVars, and assign a new value index for each repetition of a pack hole (user: zlodo size: 5999)

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
            TypeCheckingContext( const Context& c );
            TypeCheckingContext( Context&& c );

            const auto& context() const { return m_context; }
            const auto& env() const { return m_context.env(); }
            const auto& rules() const { return env()->typeCheckingRuleSet(); }

            uint32_t getLHSHoleIndex( StringId name ) const;
            uint32_t getRHSHoleIndex( StringId name ) const;

            uint32_t createValue( bool required = false );

            void setLHSHoleIndex( StringId name, uint32_t index );
            void setRHSHoleIndex( StringId name, uint32_t index );

            void eraseLHSName( StringId name );
            void eraseRHSName( StringId name );

            class SubContext
            {
                public:







|
|



|
|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
            TypeCheckingContext( const Context& c );
            TypeCheckingContext( Context&& c );

            const auto& context() const { return m_context; }
            const auto& env() const { return m_context.env(); }
            const auto& rules() const { return env()->typeCheckingRuleSet(); }

            uint32_t getLHSHoleIndex( StringId name, uint32_t repetitionIndex ) const;
            uint32_t getRHSHoleIndex( StringId name, uint32_t repetitionIndex ) const;

            uint32_t createValue( bool required = false );

            void setLHSHoleIndex( StringId name, uint32_t repetitionIndex, uint32_t index );
            void setRHSHoleIndex( StringId name, uint32_t repetitionIndex, uint32_t index );

            void eraseLHSName( StringId name );
            void eraseRHSName( StringId name );

            class SubContext
            {
                public:
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
            uint32_t                                    m_nextNamespaceIndex = 3;

            uint32_t                                    m_numUnknownValues = 0;
            int32_t                                     m_cost = 0;

            uint32_t                                    m_numAnonymousHoles = 0;

            using HoleName = pair< StringId, uint32_t >;

            struct Cow
            {
                vector< StoredValue >               values;
                unordered_map< HoleName, uint32_t > holeDict;
                unordered_set< uint32_t >           lockedHoles;

            #ifndef NDEBUG
                // In debug, keep track of which "path" was taken through the various
                // rules to end up with the result.
                using TCTrace = vector< const TCRuleInfo* >;
                mutable TCTrace currentTypeCheckingTrace;
                mutable vector< TCTrace > paramsTypeCheckingTrace;







|



|
|
|







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
            uint32_t                                    m_nextNamespaceIndex = 3;

            uint32_t                                    m_numUnknownValues = 0;
            int32_t                                     m_cost = 0;

            uint32_t                                    m_numAnonymousHoles = 0;

            using HoleKey = tuple< StringId, uint32_t, uint32_t >;

            struct Cow
            {
                vector< StoredValue >       values;
                map< HoleKey, uint32_t >    holeDict;
                unordered_set< uint32_t >   lockedHoles;

            #ifndef NDEBUG
                // In debug, keep track of which "path" was taken through the various
                // rules to end up with the result.
                using TCTrace = vector< const TCRuleInfo* >;
                mutable TCTrace currentTypeCheckingTrace;
                mutable vector< TCTrace > paramsTypeCheckingTrace;