[fpc-devel] [Patch/RFC] Warnings for (in/over)complete case statements
Michael Van Canneyt
michael at freepascal.org
Wed Jan 2 17:56:14 CET 2019
On Wed, 2 Jan 2019, Martok wrote:
> Am 02.01.2019 um 11:19 schrieb Michael Van Canneyt:
>> Consider the following:
>> TMyClass = class
>> function GetString(AIndex: Integer): string;
>> Property MyString : String Index 1 Read GetString;
>> function TMyClass.GetString(AIndex: Integer): string;
>> case AIndex of
>> 1 : Result:=GenerateSomestringvalue;
>> I don't think there should be errors or warnings.
> Good example.
> Although... you *could* call GetString from some other class member function,
> and at that point Result would be undefined. I don't think the compiler can
> prove that?
The compiler can prove that since the methods are private.
It can see no explicit calls are generated for it.
More information about the fpc-devel