PR# 14734 Bug in FUNCTION.target
Problem Report Summary
Submitter: ericbe
Category: EiffelBase
Priority: Medium
Date: 2008/08/14
Class: Bug
Severity: Serious
Number: 14734
Release: 6.3.7.4337
Confidential: No
Status: Analyzed
Responsible: manus_eiffel
Environment: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR 3.0.04506.648)
Synopsis: Bug in FUNCTION.target
Description
FUNCTION.target does not return the correct object. I get "APPLICATION" instead of "STRING_8". It's because `closed_operands' is of the form 'TUPLE [APPLICATION, STRING_8]. Note that there is no such problem with PROCEDURE.target. In that case `closed_operands' is of the form 'TUPLE [STRING_8]'.
To Reproduce
class APPLICATION create make feature make is local s1: STRING p: FUNCTION [ANY, TUPLE, INTEGER] do s1 := "gobo" p := agent s1.count print (p.target.generating_type) end end
Problem Report Interactions
I think you'd rather add a function in the generated code of STRING that returns the value of the attribute, and have an agent on that function.
This is because an inline agent on an attribute is actually implemented as an inline agent. That is to say: a := agent s1.count is transformed into: a := agent (s: STRING): INTEGER do Result := s.count end (s1) A part from the incorrect type for closed operands and target, it was giving you the expected result this is why we missed this. It will need some rethinking there.