Ignore:
Timestamp:
Nov 24, 2020, 5:48:06 PM (4 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
4702a2c
Parents:
4a359e2
Message:

Fixing test init1-ERROR on new ast. Applying equivalent of b81fd95, #189, to new AST.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    r4a359e2 rbb87dd0  
    10661066                                // unification run for side-effects
    10671067                                unify( toType, cand->expr->result, cand->env, need, have, open, symtab );
    1068                                 Cost thisCost = castCost( cand->expr->result, toType, cand->expr->get_lvalue(),
    1069                                                 symtab, cand->env );
     1068                                Cost thisCost =
     1069                                        (castExpr->isGenerated == ast::GeneratedFlag::GeneratedCast)
     1070                            ? conversionCost( cand->expr->result, toType, cand->expr->get_lvalue(), symtab, cand->env )
     1071                            : castCost( cand->expr->result, toType, cand->expr->get_lvalue(), symtab, cand->env );
     1072
    10701073                                PRINT(
    10711074                                        std::cerr << "working on cast with result: " << toType << std::endl;
     
    15431546
    15441547                                        // unification run for side-effects
    1545                                         unify( toType, cand->expr->result, env, need, have, open, symtab );
     1548                                        bool canUnify = unify( toType, cand->expr->result, env, need, have, open, symtab );
     1549                    (void) canUnify;
    15461550                                        Cost thisCost = computeConversionCost( cand->expr->result, toType, cand->expr->get_lvalue(),
     1551                                                symtab, env );
     1552                                        PRINT(
     1553                                                Cost legacyCost = castCost( cand->expr->result, toType, cand->expr->get_lvalue(),
    15471554                                                        symtab, env );
    1548 
     1555                                                std::cerr << "Considering initialization:";
     1556                                                std::cerr << std::endl << "  FROM: " << cand->expr->result << std::endl;
     1557                                                std::cerr << std::endl << "  TO: "   << toType             << std::endl;
     1558                                                std::cerr << std::endl << "  Unification " << (canUnify ? "succeeded" : "failed");
     1559                                                std::cerr << std::endl << "  Legacy cost " << legacyCost;
     1560                                                std::cerr << std::endl << "  New cost " << thisCost;
     1561                                                std::cerr << std::endl;
     1562                                        )
    15491563                                        if ( thisCost != Cost::infinity ) {
    15501564                                                // count one safe conversion for each value that is thrown away
Note: See TracChangeset for help on using the changeset viewer.