View Issue Details

IDProjectCategoryView StatusLast Update
0036189LazarusIDEpublic2019-12-12 12:14
ReportereugenelozaAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformAMD 64 bitOSDebian LinuxOS Version10.1
Product Version2.1 (SVN)Product Build62005M 
Target VersionFixed in Version 
Summary0036189: Wrong hint for indexed properties
DescriptionWhen we have some indexed property like `property V[Index: Integer]: TObject read GetV;` then typing `V.` shows hint for TObject, while this is a error. E.g. Code Tools sees `V.ClassName` as valid syntax (both hints such syntax with code completion and allows "ctrl+click" to jump to the definition), but the FreePascal compiler returns an error `Error: Wrong number of parameters specified for call to "GetV"`. See "SimpleCase" example attached.

While this is a minor issue, it becomes more confusing when the name is overloaded in the children classes. See "ComplexCase" example attached. E.g. in case we have a `function V: TSomeValue;` in a child class, we receive the wrong hint for the indexed property in the parent class instead of a valid hint for the function in child class. On the other hand FreePascal compiler handles this issue correctly and calling `TChildClass.V` unambiguously calls `function V`.
Steps To ReproduceCreate a simple program and a class TA with an indexed property V. Start typing TA.V. in the code and receive an invalid hint/completion.

You may also use the attached SimpleCase and ComplexCase examples. Address the line WriteLn(C.V.ClassName); which is seen as valid in Lazarus but returns an error when compiled or try to type C.V. to see the wrong hint / completion suggestion.
Additional InformationFree Pascal Compiler version 3.3.1-r43151 [2019/10/08] for x86_64
TagsNo tags attached.
Fixed in Revision
LazTarget-
Widgetset
Attached Files

Relationships

related to 0015248 closedMattias Gaertner Lazarus CodeTools: indexed property identifier completion 
related to 0019151 closedMattias Gaertner Patches [patch] CodeCompletion of indexed properties 
related to 0018416 closedMattias Gaertner Patches Auto-completion fails for indexed properties 
related to 0031793 new Lazarus CodeTools code creation creates invalid code on indexed properties with index 

Activities

eugeneloza

2019-10-15 22:43

reporter  

ComplexCase.tar.gz (921 bytes)
SimpleCase.tar.gz (871 bytes)

eugeneloza

2019-10-15 22:46

reporter   ~0118621

Last edited: 2019-10-15 23:42

View 2 revisions

Sorry, I've made a mistake in the last sentence of Description: should be not "TParentClass.V" but "TChildClass.V". [<- fixed by Juha]

eugeneloza

2019-10-15 22:53

reporter   ~0118622

Related to:
https://bugs.freepascal.org/view.php?id=15248
https://bugs.freepascal.org/view.php?id=19151
https://bugs.freepascal.org/view.php?id=18416
https://bugs.freepascal.org/view.php?id=31793

Issue History

Date Modified Username Field Change
2019-10-15 22:43 eugeneloza New Issue
2019-10-15 22:43 eugeneloza File Added: ComplexCase.tar.gz
2019-10-15 22:43 eugeneloza File Added: SimpleCase.tar.gz
2019-10-15 22:46 eugeneloza Note Added: 0118621
2019-10-15 22:53 eugeneloza Note Added: 0118622
2019-10-15 23:42 Juha Manninen Description Updated View Revisions
2019-10-15 23:42 Juha Manninen LazTarget => -
2019-10-15 23:42 Juha Manninen Note Edited: 0118621 View Revisions
2019-10-15 23:43 Juha Manninen Relationship added related to 0015248
2019-10-15 23:43 Juha Manninen Relationship added related to 0019151
2019-10-15 23:43 Juha Manninen Relationship added related to 0018416
2019-10-15 23:43 Juha Manninen Relationship added related to 0031793