Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Errors - Warnings    [ Add a report in this area ]  
Report #:  93738   Status: Open
Internal Error URW1136
Project:  Delphi Build #:  15.0.3953.35171
Version:    15.1 Submitted By:   Robert Love
Report Type:  Basic functionality failure Date Reported:  5/10/2011 3:55:44 AM
Severity:    Serious / Highly visible problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   283096
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
I believe the cause of this may be different than the other reported URW1136 errors.

I have created 3 different test cases, to demostrate how to get the error.

Added by Sysop
<<<<<<<<
The report is because it produces an Internal Error, instead of a valid compiler error.
Please see comments of QC for more details.
>>>>>>>>
Steps to Reproduce:
Test Case #1

unit Unit10;

interface
uses RTTI;

type
  Nullable<T> = record
    class operator Implicit(Value: Nullable<T>): TValue;
  end;
implementation

{ Nullable<T> }

class operator Nullable<T>.Implicit(Value: Nullable<T>): TValue;
begin
  result := TValue.From(Value);
end;

end.


Test Case #2

unit Unit10;

interface
uses RTTI;

type
  Nullable<T> = record
    function ToTValue : TValue;
  end;

implementation

{ Nullable<T> }

function Nullable<T>.ToTValue: TValue;
begin
   result := TValue.From(Self);
end;

end.


Test Case #3
unit Unit10;

interface
uses RTTI;

type
  Nullable<T> = record
  end;

  TestClass = class
    class function ToTValue<T>(Value : Nullable<T>) : TValue;
  end;


implementation


class function TestClass.ToTValue<T>(Value: Nullable<T>): TValue;
begin
result := TValue.From(Value);
end;

end.
Workarounds
None
Attachment
None
Comments

Tomohiro Takahashi at 5/10/2011 6:16:41 AM -
In Test Case #1, this line causes compile error.
>   result := TValue.From(Value);
So, how about specify type parameter as below?
  result := TValue.From<Nullable<T>>(Value);
instead of
  result := TValue.From(Value);

Robert Love at 5/10/2011 11:41:21 AM -
Yes it does produce a compiler error.  The report is because it produces an Internal Error, instead of a valid compiler error.

Pierre Yager at 5/10/2011 7:56:46 AM -
This works (considering Nullable<T> is one from Allen Bauer described in http://blogs.embarcadero.com/abauer/2008/09/18/38869

type
  Nullable<T> = record
  private
    FValue: T;
    FHasValue: IInterface;
  public
    ...
    property HasValue: Boolean read GetHasValue;
    property Value: T read GetValue;
    ...
    class operator Implicit(Value: Nullable<T>): TValue;
  end;

implementation

class operator Nullable<T>.Implicit(Value: Nullable<T>): TValue;
begin
  if Value.HasValue then
    Result := TValue.From<T>(Value.Value)
  else
    Result := TValue.Empty;
end;

Robert Love at 5/10/2011 11:45:15 AM -
Yes that code returns the internal value.     The report is about an Internal Error which should not occur.

Server Response from: ETNACODE01