Bug? Renaming a routine to make it a property

LucaMs

Expert
Licensed User
Longtime User
I changed the name of a routine from (example):
B4X:
SetSomething(Value As Int)
to
B4X:
setSomething(Value As Int)
since I realized that it is indeed a property.

In the project the call of that routine was obviously like:
B4X:
MyObject.SetSomething(5)
now, after renamed the routine everywhere (automatically, using F7), it is:
B4X:
MyObject.setSomething(5)
This line should show a warning and stop compilation but this does not happen [despite the object shows correctly that Something is a property - wrench icon]
Instead, it happens by immediately writing the two things, the routine and the call, in the wrong way.


[already tried to clean the project]
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
This is what I mean:

Clipboard02.jpg




Rightly I get an error and cannot compile the project. Instead, in my "old" project, once renamed a routine name "changing its type" to property (you know, its name now starts with "set") no errors and I can compile (but not tested at runtime), although there are calls like that in the project (obj.MyProperty(123))

EDIT:
This code is wrong and I posted it right to explain that the IDE does not report errors on my real project, it is compiled without problems although it contains the same errors.
I changed a class method "making it as property", so I knew that then I would have to go and fix the calls to this "no-more-method but now properties" but, as mentioned, no errors are highlighted and the program compiles without problems, even though the project contains those errors, that is: Obj.setMyProperty(88) instead of Obj.MyProperty = 88
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Your code is wrong. It should be B4XPages.MainPage.MyProperty = 14
Erel... I KNOW - Maybe I'm not a great expert but not even a beginner (I would be happy to be, I would be 15 years old ?)

How can I explain the question better? Last attempt.

1 - I have a project with code like this:
B4X:
' My class
Public Sub SetSomething(Value As Int) ' <--- method


' Elsewhere in the project
objMyClass.SetSomething(55)
It's ok, I called the method of my class.

Now I press F7 on SetSomething to rename it. I change its name to setSomething, so it will be a Property; doing so, all the calls found in the project will be automaticaly changed like:

' Elsewhere in the project
B4X:
objMyClass.setSomething(55)
and then all these calls SHOULD be wrong now, as they must be:
' Elsewhere in the project
B4X:
objMyClass.Something = 55 ' <--- now Something is a Propety, no more a method
Well, these errors are not reported and the project is compiled without problems (but I have not then run it).
These kind of erros are correctly reported and compiling stopped only if I make this mistake "from scratch".

Edited also my previous post, hoping to help to understand.


Let me know if, even re-reading the previous posts, the question is still not clear, in which case I would post more images, of the real project.
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
How can I explain the question better?
By attaching a project which works although it shouldn't.

There is a Property, setMethodToBeChanged, which originally was a method (SetMethodToBeChanged) and after changed to Property by renaming it.
After this renaming the IDE should report the error of the calling line not manually changed yet. The call still is:
B4X:
.SetMethodToBeChanged(22)
and it works, although it shouldn't.


After reading better your first answer...
This is not considered a bug. You can call properties with the full name. There is no good reason to do it but the compiler doesn't enforce it.
now :( I understand.

So it is not a bug; you should (must ?) just change the compiler so that it enforces to use the correct way.
[and I need at least three coffees]
 

Attachments

  • ChangingToProp.zip
    8.6 KB · Views: 227
Last edited:
Top