Goose  Diff

Differences From Artifact [cb9fa9c0ab]:

  • File bs/builtins/types/reference/typecheck.cpp — part of check-in [23ecb4f9cb] at 2021-11-25 21:21:51 on branch trunk — Got rid of the where operator. Predicates are now added to types simply by following the type with a proposition list. (user: zlodo size: 8370)

To Artifact [9fb6fb40ae]:

  • File bs/builtins/types/reference/typecheck.cpp — part of check-in [ef60c39ded] at 2022-04-04 23:20:23 on branch trunk —
    • Fixed incorrect argument types for z3 func decls
    • Fixed template ghost funcs
    • Encode address calculations into z3
    • Added a typechecking rule to unwrap references of references (which happen when we pass a variable containing a reference)
    (user: zlodo size: 9344)

214
215
216
217
218
219
220


























221
222
223
224
225
226
227
                co_return;

            auto ref = ValueToEIR( ToValue( BuildLocalVarMutRef( *locvar ) )
                .setLocationId( lvval.locationId() ) );

            co_yield TypeCheck( lhs, ref, tcc );
        } );



























        // Implicit referencing of non-variables against a non mutable ref: build a tempref
        e.typeCheckingRuleSet()->addTypeCheckingRule( TCRINFOS,

            ValueToEIR( ValuePattern(
                ANYTERM( _ ),
                refTypePattern,







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
                co_return;

            auto ref = ValueToEIR( ToValue( BuildLocalVarMutRef( *locvar ) )
                .setLocationId( lvval.locationId() ) );

            co_yield TypeCheck( lhs, ref, tcc );
        } );

        // Typechecking ref of ref against a ref: dereference the firs tref and attempt tp typecheck it
        // against the other ref
        e.typeCheckingRuleSet()->addTypeCheckingRule( TCRINFOS,

            ParamPat( refTypePattern ),

            ValueToEIR( ValuePattern(
                ANYTERM( _ ),
                refRefTypePattern,
                ANYTERM( _ ) ) ),

        []( const Term& lhs, const Term& rhs, const TypeCheckingContext& tcc ) -> TCGen
        {
            auto ltype = ValuePatternFromEIR( lhs )->type();

            auto rrefVal = *EIRToValue( rhs );
            auto rrType = FromValue< ReferenceType >( *EIRToValue( rrefVal.type() ) );
            if( !rrType )
                co_return;

            auto content = ValueToEIR( BuildComputedValue( rrType->type(),
                cir::Load( rrefVal.cir(), rrType->type() ) ).setLocationId( rrefVal.locationId() ) );

            co_yield TypeCheck( lhs, content, tcc );
        } );

        // Implicit referencing of non-variables against a non mutable ref: build a tempref
        e.typeCheckingRuleSet()->addTypeCheckingRule( TCRINFOS,

            ValueToEIR( ValuePattern(
                ANYTERM( _ ),
                refTypePattern,