Changeset b9f383f for src/ResolvExpr


Ignore:
Timestamp:
Apr 27, 2018, 2:35:00 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
5527759
Parents:
de6319f
Message:

named threads in thread tests
fixed bounded buffer expect
added error check for waitfor with no parameters
added missing parameters to bounded buffer EXT

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    rde6319f rb9f383f  
    492492                        }
    493493
     494                        if(clause.target.arguments.empty()) {
     495                                SemanticError( stmt->location, "Waitfor clause must have at least one mutex parameter");
     496                        }
     497
    494498                        // Find all alternatives for all arguments in canonical form
    495499                        std::vector< AlternativeFinder > argAlternatives;
     
    556560                                                        auto param_end = function->parameters.end();
    557561
     562                                                        int n_mutex_arg = 0;
     563
    558564                                                        // For every arguments of its set, check if it matches one of the parameter
    559565                                                        // The order is important
     
    564570                                                                        // We ran out of parameters but still have arguments
    565571                                                                        // this function doesn't match
    566                                                                         SemanticError( function, "candidate function not viable: too many mutex arguments\n" );
     572                                                                        SemanticError( function, toString("candidate function not viable: too many mutex arguments, expected ", n_mutex_arg, "\n" ));
    567573                                                                }
    568574
     575                                                                n_mutex_arg++;
     576
    569577                                                                // Check if the argument matches the parameter type in the current scope
    570                                                                 if( ! unify( (*param)->get_type(), arg.expr->get_result(), resultEnv, resultNeed, resultHave, openVars, this->indexer ) ) {
     578                                                                if( ! unify( arg.expr->get_result(), (*param)->get_type(), resultEnv, resultNeed, resultHave, openVars, this->indexer ) ) {
    571579                                                                        // Type doesn't match
    572580                                                                        stringstream ss;
    573581                                                                        ss << "candidate function not viable: no known convertion from '";
     582                                                                        (*param)->get_type()->print( ss );
     583                                                                        ss << "' to '";
    574584                                                                        arg.expr->get_result()->print( ss );
    575                                                                         ss << "' to '";
    576                                                                         (*param)->get_type()->print( ss );
    577585                                                                        ss << "'\n";
    578586                                                                        SemanticError( function, ss.str() );
     
    588596                                                                // We ran out of arguments but still have parameters left
    589597                                                                // this function doesn't match
    590                                                                 SemanticError( function, "candidate function not viable: too few mutex arguments\n" );
     598                                                                SemanticError( function, toString("candidate function not viable: too few mutex arguments, expected ", n_mutex_arg, "\n" ));
    591599                                                        }
    592600
Note: See TracChangeset for help on using the changeset viewer.