pike.git/
src/
pike_types.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2020-09-07
2020-09-07 21:05:33 by Henrik Grubbström (Grubba) <grubba@grubba.org>
39b7e8c9d0e3e614a3cb7a948699a2921afa86b9 (
29
lines) (+
9
/-
20
)
[
Show
|
Annotate
]
Branch:
master
Compiler
[Typechecker]
: Fix soft casting of complex function types.
6823:
if (soft_type->type == T_FUNCTION) soft_type = soft_type->cdr; if (orig_type->type == T_FUNCTION) orig_type = orig_type->cdr; }
-
#ifdef
PIKE_DEBUG
-
if ((
soft_type->type != T_MANY) || (
orig_type->type
!
= T_MANY)
)
{
-
fprintf(stderr,
-
"Strange function type
(
expected MANY node).\n"
-
"Orig type: ");
-
simple
_
describe_
type
(orig_
type
);
-
fprintf(stderr, "\n"
-
"Soft type: ");
-
simple
_
describe_type(soft_type
)
;
-
fprintf(stderr, "\n"
)
;
-
Pike_fatal("Strange function type in soft cast.\n");
-
}
-
#endif /* PIKE_DEBUG */
+
if ((orig_type->type =
=
T_MANY)
&&
+
(
soft
_type
->
type
==
T
_
MANY
))
{
if (!(tmp2 = soft_cast(soft_type->car, orig_type->car, flags ^ SOFT_WEAKER))) { goto function_cast_fail;
6843:
push_finished_type(tmp2); free_type(tmp2); tmp2 = NULL;
-
if ((orig_type->type == T_MANY) &&
-
(soft_type->type == T_MANY)) {
+
/* Note: Special case for the return type in case of create(). */ if (tmp) { orig_type = tmp;