Goose  Diff

Differences From Artifact [fe935bcfc2]:

  • File bs/builtins/types/localvar/localvar.cpp — part of check-in [2370e98869] at 2021-03-02 22:51:58 on branch trunk — Removed magic "tuple of types to tuple type" conversions and moved them into extension points so that any type can implement similar semantics (user: achavasse size: 9409)

To Artifact [4e8c5b5e0d]:

  • File bs/builtins/types/localvar/localvar.cpp — part of check-in [3cf6ab5249] at 2021-03-04 21:47:51 on branch trunk —
    • Refactored and simplified the way integer and string constants are handled: we no longer try to resolve them during typechecking, this breaks when parametric types are involved and also it makes no sense, typechecking is about types, not values
    • Fixed multiple places where locationIds weren't propagated
    • Verifier: variable assignments now verify the destination variable type's refinement conditions
    • Fixed a test where the above change detected a bug, kept the bugged version as a new verification failure test
    (user: achavasse size: 9559)

30
31
32
33
34
35
36



37
38
39
40
41
42
43
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46







+
+
+







        auto bb = cfg->currentBB();
        if( !bb )
            return PoisonValue();

        Value typeVal = *ValueFromEIR( type );
        if( !typeVal.isType() )
            typeVal = ToType( c, typeVal );

        if( !ParseTypePredicates( c, c.identity(), typeVal ) )
            return PoisonValue();

        LocalVar lv( name, ValueToEIR( typeVal ), index );
        bb->emplace_back( AllocVar( typeVal, index ) );

        Value initResult;

        {
165
166
167
168
169
170
171
172



173
174
175
176
177
178
179
168
169
170
171
172
173
174

175
176
177
178
179
180
181
182
183
184







-
+
+
+







            Vec(
                SubTerm(),  // locvar
                SubTerm()   // initializer
            )
        );

        auto&& [type, initializer] = *callDecomp;
        auto initializerVal = *ValueFromEIR( initializer );

        if( !ParseTypePredicates( c, c.identity(), *ValueFromEIR( type ) ) )
            return PoisonValue();

        auto index = cfg->getNewTemporaryIndex();

        // Retrieve the texpr's location and set it on the inferred type. This way if an
        // error occurs later with it, for instance when calling LowerTypeForRuntime on it during codegen,
        // it will have a meaningful location for the error message to attach itself on.
        uint32_t typeLoc = ValueFromEIR( typeTExpr )->locationId();