PR# 19417 Automatic casting of INTEGER to REAL does not happen for agent function calls

Problem Report Summary
Submitter: finnianr
Category: Compiler
Priority: Low
Date: 2017/12/06
Class: Bug
Severity: Non-critical
Number: 19417
Release: 16.05
Confidential: No
Status: Closed
Responsible:
Environment: linux
Synopsis: Automatic casting of INTEGER to REAL does not happen for agent function calls

Description
Automatic casting of INTEGER to REAL does not happen for agent function calls
To Reproduce
It is not possible to compile the attached test set
Problem Report Interactions
From:alexk_es    Date:2018/02/26    Status: Closed    Download   
This is expected. Let's consider the following declarations:

   r: REAL_32
   i: INTEGER_32
   t: TUPLE [REAL_32]

The conversion takes place only for top-level values, not for nested ones. I.e.,

   r := i

would work. But this code:

   t := [i]

would not compile because there are no rules that tell to perform conversion inside the manifest tuple. 

At the moment, the agents accept TUPLEs as arguments, so the same applies here. So, although, there is syntax sugar for calling agents similar to regular features, the machinery behind remains the same, i.e. the call

   l_cosine (0)

is identical to either

   l_cosine.item (0)

or

   l_cosine.item ([0])

whatever fits.

The formal argument type of the agent is TUPLE [REAL_32], but neither INTEGER_32 (the type of 0) nor TUPLE [INTEGER_32] (the type of [0]) conforms to TUPLE [REAL_32]. Therefore, the compiler reports the error.

From:finnianr    Date:2017/12/06    Download   
Attachments for problem report #19417

Attachment: tuple_test_set.e     Size:343