"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/libponyc/expr/call.c" between
ponyc-0.33.1.tar.gz and ponyc-0.33.2.tar.gz

About: Pony is an object-oriented, actor-model, capabilities-secure, high performance programming language.

call.c  (ponyc-0.33.1):call.c  (ponyc-0.33.2)
#include "call.h" #include "call.h"
#include "postfix.h" #include "postfix.h"
#include "control.h" #include "control.h"
#include "literal.h" #include "literal.h"
#include "reference.h" #include "reference.h"
#include "../ast/astbuild.h" #include "../ast/astbuild.h"
#include "../ast/lexer.h"
#include "../pkg/package.h" #include "../pkg/package.h"
#include "../pass/expr.h" #include "../pass/expr.h"
#include "../pass/sugar.h" #include "../pass/sugar.h"
#include "../type/alias.h" #include "../type/alias.h"
#include "../type/cap.h"
#include "../type/assemble.h" #include "../type/assemble.h"
#include "../type/lookup.h" #include "../type/lookup.h"
#include "../type/reify.h" #include "../type/reify.h"
#include "../type/safeto.h" #include "../type/safeto.h"
#include "../type/sanitise.h" #include "../type/sanitise.h"
#include "../type/subtype.h" #include "../type/subtype.h"
#include "../type/viewpoint.h" #include "../type/viewpoint.h"
#include "ponyassert.h" #include "ponyassert.h"
static bool insert_apply(pass_opt_t* opt, ast_t** astp) static bool insert_apply(pass_opt_t* opt, ast_t** astp)
skipping to change at line 406 skipping to change at line 408
errorframe_t info = NULL; errorframe_t info = NULL;
bool ok = is_subtype(a_type, t_type, &info, opt); bool ok = is_subtype(a_type, t_type, &info, opt);
if(!ok) if(!ok)
{ {
errorframe_t frame = NULL; errorframe_t frame = NULL;
ast_error_frame(&frame, ast, ast_error_frame(&frame, ast,
"receiver type is not a subtype of target type"); "receiver type is not a subtype of target type");
ast_error_frame(&frame, ast_child(lhs),
"receiver type: %s", ast_print_type(a_type)); switch (ast_id(a_type)) { // provide better information if the refcap is `th
is->*`
case TK_ARROW:
ast_error_frame(&frame, ast_child(lhs),
"receiver type: %s (which becomes '%s' in this context)", ast_print_ty
pe(a_type), ast_print_type(viewpoint_upper(a_type)));
break;
default:
ast_error_frame(&frame, ast_child(lhs),
"receiver type: %s", ast_print_type(a_type));
}
ast_error_frame(&frame, cap, ast_error_frame(&frame, cap,
"target type: %s", ast_print_type(t_type)); "target type: %s", ast_print_type(t_type));
errorframe_append(&frame, &info); errorframe_append(&frame, &info);
if(ast_checkflag(ast_type(method_receiver(lhs)), AST_FLAG_INCOMPLETE)) if(ast_checkflag(ast_type(method_receiver(lhs)), AST_FLAG_INCOMPLETE))
ast_error_frame(&frame, method_receiver(lhs), ast_error_frame(&frame, method_receiver(lhs),
"this might be possible if all fields were already defined"); "this might be possible if all fields were already defined");
if(!can_recover && cap_recover && is_subtype(r_type, t_type, NULL, opt)) if(!can_recover && cap_recover && is_subtype(r_type, t_type, NULL, opt))
{ {
ast_error_frame(&frame, ast, ast_error_frame(&frame, ast,
"this would be possible if the arguments and return value " "this would be possible if the arguments and return value "
"were all sendable"); "were all sendable");
} }
ast_t* fn = ast_nearest(lhs, TK_FUN);
if (fn != NULL && ast_id(a_type) == TK_ARROW)
{
ast_t* iso = ast_child(fn);
pony_assert(iso != NULL);
token_id iso_id = ast_id(iso);
ast_t* t_cap = cap_fetch(t_type);
pony_assert(t_cap != NULL);
if (ast_id(t_cap) == TK_REF && (iso_id == TK_BOX || iso_id == TK_VAL || is
o_id == TK_TAG))
{
ast_error_frame(&frame, iso, "you are trying to change state in a %s fun
ction; this would be possible in a ref function", lexer_print(iso_id));
}
}
errorframe_report(&frame, opt->check.errors); errorframe_report(&frame, opt->check.errors);
} }
if(a_type != r_type) if(a_type != r_type)
ast_free_unattached(a_type); ast_free_unattached(a_type);
ast_free_unattached(r_type); ast_free_unattached(r_type);
ast_free_unattached(t_type); ast_free_unattached(t_type);
return ok; return ok;
} }
 End of changes. 4 change blocks. 
2 lines changed or deleted 34 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)