Bug? IDE - class property bug

wl

Well-Known Member
Licensed User
Longtime User
in V.3:

Create a class ("MyClass') like this:

B4X:
private someProp as int
...
public getSomeProp as int
  return someProp
end sub

(Save the class)

In another module try code completion: MyClass.: it will not display SomeProp as a possible property
Probably this is caused by the private variable having the same name as the public property ...

Change the class implementation to:

B4X:
private p_someProp as int
...
public getSomeProp as int
  return p_someProp
end sub

(Save the class)

Still code completion will NOT display SomeProp as possible property.

Rename the property to:

B4X:
public getSomeProp2 as int
  return p_someProp
end sub

(save the class)

Code completion WILL show SomeProp2 as possible property

Rename the property back to:

B4X:
public getSomeProp as int
  return p_someProp
end sub

(save the class)

Code completion NOW WILL show SomeProp as possible property
 
Last edited:

jmon

Well-Known Member
Licensed User
Longtime User
i think that it's because you didn't save after changing to:

B4X:
private p_someProp as int
...
public getSomeProp as int
  return p_someProp
end sub

If this problem is not fixable, I would suggest to have a clear error message showing that a global variable has the same name as a property. I bump into this problem so many times and always wondered what I did wrong because the error message isn't self explanatory.
 

wl

Well-Known Member
Licensed User
Longtime User
I'm pretty sure I saved in between, but I'll have to double-check....

An error message in this case would indeed be helpful...
 
Top