Ansicht
Dokumentation

ABENREDUCE_TYPE_INFERENCE_ABEXA - REDUCE TYPE INFERENCE ABEXA

ABENREDUCE_TYPE_INFERENCE_ABEXA - REDUCE TYPE INFERENCE ABEXA

Fill RESBD Structure from EBP Component Structure   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book

Reduce Operator, Type Inference

This example demonstrates a type inference for the conversion operator REDUCE.

Source Code

Execute

Description

Constructor expressions with the conversion operator REDUCE are passed to differently typed formal parameters of methods. In the case of generic formal parameters, special rules apply when determining the operand type.

  • Completely typed formal parameter
When the method meth1 is called with a completely typed formal parameter, the operand type for # is determined by this parameter and the result of the reduction is converted to c with length 10 in both calls.
  • Formal parameter typed generically with c
The operand type for # is determined by the first declaration after INIT.
  • In the first call, the type c with length 20 of the declaration after INIT matches the generic type and is used.

  • It is not possible to perform a call with the type i of the declaration after INIT, since it does not match the typing and there are no inference rules for the generic type c.

  • Formal parameter typed generically with csequence
  • In the first call, the type c with length 20 of the declaration after INIT matches the generic type and is used.

  • In the second call, the type i of the declaration after INIT does not match the generic type and the type string is used, which is indicated by a syntax check warning.






BAL_S_LOG - Application Log: Log header data   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 2272 Date: 20240426 Time: 155949     sap01-206 ( 31 ms )