Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    rd958834b r9e23b446  
    4141#include "Common/utility.h"       // for move, copy
    4242#include "SymTab/Mangler.h"
     43#include "SymTab/Validate.h"      // for validateType
    4344#include "Tuples/Tuples.h"        // for handleTupleAssignment
    4445#include "InitTweak/InitTweak.h"  // for getPointerBase
     
    897898                                                }
    898899
    899                                                 if (argType.as<ast::PointerType>()) funcFinder.otypeKeys.insert(Mangle::Encoding::pointer);                                             
    900                                                 // else if (const ast::EnumInstType * enumInst = argType.as<ast::EnumInstType>()) {
    901                                                 //      const ast::EnumDecl * enumDecl = enumInst->base; // Here
    902                                                 //      if ( const ast::Type* enumType = enumDecl->base ) {
    903                                                 //              // instance of enum (T) is a instance of type (T)
    904                                                 //              funcFinder.otypeKeys.insert(Mangle::mangle(enumType, Mangle::NoGenericParams | Mangle::Type));
    905                                                 //      } else {
    906                                                 //              // instance of an untyped enum is techically int
    907                                                 //              funcFinder.otypeKeys.insert(Mangle::mangle(enumDecl, Mangle::NoGenericParams | Mangle::Type));
    908                                                 //      }
    909                                                 // }
     900                                                if (argType.as<ast::PointerType>()) funcFinder.otypeKeys.insert(Mangle::Encoding::pointer);
     901                                                else if (const ast::EnumInstType * enumInst = argType.as<ast::EnumInstType>()) {
     902                                                        const ast::EnumDecl * enumDecl = enumInst->base;
     903                                                        if ( const ast::Type* enumType = enumDecl->base ) {
     904                                                                // instance of enum (T) is a instance of type (T)
     905                                                                funcFinder.otypeKeys.insert(Mangle::mangle(enumType, Mangle::NoGenericParams | Mangle::Type));
     906                                                        } else {
     907                                                                // instance of an untyped enum is techically int
     908                                                                funcFinder.otypeKeys.insert(Mangle::mangle(enumDecl, Mangle::NoGenericParams | Mangle::Type));
     909                                                        }
     910                                                }
    910911                                                else funcFinder.otypeKeys.insert(Mangle::mangle(argType, Mangle::NoGenericParams | Mangle::Type));
    911912                                        }
     
    10901091                        assert( toType );
    10911092                        toType = resolveTypeof( toType, context );
     1093                        // toType = SymTab::validateType( castExpr->location, toType, symtab );
    10921094                        toType = adjustExprType( toType, tenv, symtab );
    10931095
     
    12631265                                        newExpr, copy( tenv ), ast::OpenVarSet{}, ast::AssertionSet{}, Cost::zero,
    12641266                                        cost );
     1267
     1268                                if (newCand->expr->env) {
     1269                                        newCand->env.add(*newCand->expr->env);
     1270                                        auto mutExpr = newCand->expr.get_and_mutate();
     1271                                        mutExpr->env  = nullptr;
     1272                                        newCand->expr = mutExpr;
     1273                                }
     1274
    12651275                                PRINT(
    12661276                                        std::cerr << "decl is ";
     
    15801590                                // calculate target type
    15811591                                const ast::Type * toType = resolveTypeof( initAlt.type, context );
     1592                                // toType = SymTab::validateType( initExpr->location, toType, symtab );
    15821593                                toType = adjustExprType( toType, tenv, symtab );
    15831594                                // The call to find must occur inside this loop, otherwise polymorphic return
Note: See TracChangeset for help on using the changeset viewer.