Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Language    [ Add a report in this area ]  
Report #:  113547   Status: Closed
Record Helper do not work with Generics declared in another unit
Project:  Delphi Build #:  17.0.4770.56661
Version:    17.2 Submitted By:   Bruno Fratini
Report Type:  Basic functionality failure Date Reported:  3/11/2013 5:08:50 AM
Severity:    Serious / Highly visible problem Last Updated: 4/15/2014 6:45:40 PM
Platform:    All platforms Internal Tracking #:   37127
Resolution: Fixed (Resolution Comments) Resolved in Build: : XE6
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 30
Description
Record Helper do not work with Generics declared in another unit

Added by Sysop
<<<<<<
This issue is related to QC#113548.
>>>>>>

See Steps and the attached "doc" (MS Word) document for full details and screenshots
Steps to Reproduce:
1. Create a new Console Application

2. Add a new empty unit to the project

3. In the added unit add the following generic record type definition:
------
type
  TMyRec<T> = record
    Field: T;
  end;
------

4. In the same type section declare a defined type record from TMyRec<T> as following:
------
  TMyIntRec = TMyRec<Integer>;
------

5. Open a new type section
                   o
This is due to another already logged defect: If not in a new "type" section no record helper can be declared for TMyIntRec

6. Declare a record helper for TMyIntRec as following:
------
type
  TMyIntRecHelper = record helper for TMyIntRec
  public
    function Hello: Integer;
  end;
------

7. In the main project code add a variable of TMyIntRec type
------
var
  Rec: TMyIntRec;
------

8. In the main code make a call to the "Hello" method introduced with TMyIntRecHelper using the Rec variable
------
    Rec.Hello;
------

9. Try to compile the project

Issue
The application won't compile with the error message "E2003 Undeclared identifier: 'Hello'" as the TMyIntRecHelper record does not exist.
Workarounds
None
Attachment
RecordHelper Do Not Work with Generics Declared in A
Comments

Bruno Fratini at 3/14/2013 9:57:09 AM -
Changed the version to 17.0 (Delphi XE3) because it was wrongly logged as 17.1 (Project 64).

Bruno Fratini at 3/26/2013 4:46:40 AM -
Changing version from 17.0 to 17.2 accordingly to the operator resolution for QC#113736

Server Response from: ETNACODE01