Skip to content

Commit e34d442

Browse files
committed
Mention fallback case for type coercion in description
of function resolution procedure.
1 parent e4eb910 commit e34d442

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

doc/src/sgml/typeconv.sgml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ select "string"
279279
category if any candidate accepts that category (this bias towards string
280280
is appropriate since an unknown-type literal does look like a string).
281281
Otherwise, if all the remaining candidates accept the same type category,
282-
select that category; otherwise raise an error because
282+
select that category; otherwise fail because
283283
the correct choice cannot be deduced without more clues. Also note whether
284284
any of the candidates accept a preferred datatype within the selected category.
285285
Now discard operator candidates that do not accept the selected type category;
@@ -292,7 +292,7 @@ argument.
292292
<para>
293293
If only one candidate remains, use it. If no candidate or more than one
294294
candidate remains,
295-
then raise an error.
295+
then fail.
296296
</para>
297297
</step>
298298
</substeps>
@@ -488,7 +488,7 @@ select "string"
488488
category if any candidate accepts that category (this bias towards string
489489
is appropriate since an unknown-type literal does look like a string).
490490
Otherwise, if all the remaining candidates accept the same type category,
491-
select that category; otherwise raise an error because
491+
select that category; otherwise fail because
492492
the correct choice cannot be deduced without more clues. Also note whether
493493
any of the candidates accept a preferred datatype within the selected category.
494494
Now discard operator candidates that do not accept the selected type category;
@@ -501,11 +501,22 @@ argument.
501501
<para>
502502
If only one candidate remains, use it. If no candidate or more than one
503503
candidate remains,
504-
then raise an error.
504+
then fail.
505505
</para>
506506
</step>
507507
</substeps>
508508
</step>
509+
<step performance="required">
510+
<para>
511+
If no best match could be identified, see whether the function call appears
512+
to be a trivial type coercion request. This happens if the function call
513+
has just one argument and the function name is the same as the (internal)
514+
name of some datatype. Furthermore, the function argument must be either
515+
an unknown-type literal or a type that is binary-compatible with the named
516+
datatype. When these conditions are met, the function argument is coerced
517+
to the named datatype.
518+
</para>
519+
</step>
509520
</procedure>
510521

511522
<sect2>
@@ -699,8 +710,7 @@ Otherwise, ignore the <type>unknown</type> inputs while choosing the type.
699710

700711
<step performance="required">
701712
<para>
702-
If the non-unknown inputs are not all of the same type category, raise an
703-
error.
713+
If the non-unknown inputs are not all of the same type category, fail.
704714
</para></step>
705715

706716
<step performance="required">

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy