Helper types with literal values cause CodeTools access violation
Original Reporter info from Mantis: sysrpl
-
Reporter name: Anthony Walter
Original Reporter info from Mantis: sysrpl
- Reporter name: Anthony Walter
Description:
Somewhat related to issue #28860 (closed)
CodeTools now provides code insight on help typer methods and properties, but it will throw and access violation when insight attempts to show a literal value.
For example, if you type:
'Hello'.
And there is a type helper on the string type, and access violation occurs.
Steps to reproduce:
Create a new project and add add a new unit such as HelperTest. In the form unit, add the new unit to the uses clauses. Try typing "'Hello'." and press Ctrl + Space. You will receive an access violation.
unit HelperTest;
{$mode delphi}
interface
{ TStringHelper }
type
TStringHelper = record helper for string
private
function GetTheLength: Integer;
public
function Twice: string;
function Thrice: string;
property TheLength: Integer read GetTheLength;
end;
implementation
function TStringHelper.GetTheLength: Integer;
begin
Result := Length(Self)
end;
function TStringHelper.Twice: string;
begin
Result := Self + Self;
end;
function TStringHelper.Thrice: string;
begin
Result := Self + Self + Self;
end;
end.
Mantis conversion info:
- Mantis ID: 28861
- OS: Ubunut
- OS Build: 14.04 64bit
- Build: rev 49901
- Platform: Linux
- Version: 1.5 (SVN)
- Fixed in revision: 50085 (#17401566)