Bug 60752 - Wrong result because 'Property Let' fails to execute
Summary: Wrong result because 'Property Let' fails to execute
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.0.0.0.alpha0+ Master
Hardware: x86-64 (AMD64) All
: medium major
Assignee: Noel Power
URL:
Whiteboard: target:4.1.0 target:4.0.2
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-12 22:25 UTC by tim
Modified: 2013-03-29 12:59 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Test file for Basic LET problem (4.53 KB, application/vnd.oasis.opendocument.base)
2013-02-13 09:53 UTC, tim
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tim 2013-02-12 22:25:40 UTC
In LO 4.0.0.3 Basic ClassModules fail to implement/execute the LET Property.  These run fine in 3.6.5 and previous releases.  A trivial version follows.

In Module Point:

[code]
Option Compatible
Option ClassModule

'Option Explicit

REM -----------------------------------------------------------------------------------------------------------------------
REM --- Internal Variables                                                                           ---
REM -----------------------------------------------------------------------------------------------------------------------
Private ZX      As Double
Private ZY      As Double

REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS                                                                    ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
'   Default point = Origin of axis
   ZX = 0
   ZY = 0
End Sub      '   Constructor

REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
   ZX = - 4.94065645841247E-324      '   Most negative value allowed for Double variables
   ZY = - 4.94065645841247E-324
end sub

REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES                                                                 ---
REM -----------------------------------------------------------------------------------------------------------------------

Public Property Get X() As Double
   X = ZX
End Property

Public Property Let X(ByVal pValue As Double)
   ZX = pValue
End Property

REM -----------------------------------------------------------------------------------------------------------------------
Public Property Get Y() As Double
   Y = ZY
End Property

Public Property Let Y(ByVal pValue As Double)
   ZY = pValue
End property

REM -----------------------------------------------------------------------------------------------------------------------

Public Property Get Dummy() As Double
   Dummy = 0
End Property

REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS                                                                              ---
REM -----------------------------------------------------------------------------------------------------------------------

Public Sub Move(ByVal pX As Double, ByVal pY As Double)
   ZX = ZX + pX
   ZY = ZY + pY
End Sub
[/code]

And Test Program:

[code]
Sub TestPoint
   Dim a As Object
   Set a = New Point
   Dim z as variant
   a.X = 4
   a.Y = 1
   z = a.X
   MsgBox a.X
End Sub
[/code]

The two LETs a.X and a.Y do nothing.  When debugging and stepping through, the LETs do not execute any code.  The GET (z = a.X) does.

The Message box should say "4".  It does on 3.6.5.  On LO 4 it says "0".
Comment 1 Rainer Bielefeld Retired 2013-02-13 05:24:35 UTC
@tim
Please attach a sample document with a working version of your Baisc program
Comment 2 tim 2013-02-13 09:53:32 UTC
Created attachment 74739 [details]
Test file for Basic LET problem
Comment 3 tim 2013-02-13 09:55:36 UTC
Apologies - my comments on the attachment to my previous comment got lost.

The code is all in my report, but the attachment has much the same code.

You have to run the Macro TestPoint using the BASIC IDE.

If it reports "4" it has worked.  If it reports "0" the LET has failed.
Comment 4 Rainer Bielefeld Retired 2013-02-13 10:06:28 UTC
[Reproducible] with server installation of  "Version 4.1.0.0.alpha0+ (Build ID: bdfd8de57bf5767ce5c179a5e8705c7587f7b32) TinderBox: Win-x86@6, Branch:master, Pull Time: 2013-02-06_22:06:22" ENGLISH UI / German Locale  on German WIN7 Home Premium (64bit) with own separate User Profile:

0. Launch LibO
1. Make sure that macro execution is allowed
2. Form Start Center open reporter's sample'
3. Menu 'Tools -> Macros -> Run Macro -> TestLO4.odb -> Standard -> Test -> 
   Macro "TestPoint" <Run>'
   Expected (from LibO 3.6): Shows result "4"
   Actual:  Shows result "0"

I will do some more research before I switch Bug to NEW.
Comment 5 Jean-Pierre Ledure 2013-02-13 12:59:51 UTC
1) If in the sample of code next lines

[code]
----------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES                                                                 ---
REM ----------------------------------------------------------------------------------

Public Property Get X() As Double
   X = ZX
End Property

Public Property Let X(ByVal pValue As Double)
   ZX = pValue
End Property
[/code]

are replaced by

[code]
----------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES                                                                 ---
REM ----------------------------------------------------------------------------------

Public Property Get X() As Double
   X = ZX
End Property

Public Property Set X(ByVal pValue As Double)
   ZX = pValue
End Property
[/code]

i.e. Set instead of Let, the program runs as in versions <= LO 3.6. But the Property Set syntax is normally reserved to assigning objects to properties, not basic values (strings, numbers, ...). Additionally Let is compatible with VBA, Set is not.

2) The same behaviour is observed on other operating systems: same experience for me in LO 4.0 Portable on a Windows7 platform.
Comment 6 tim 2013-02-24 22:04:07 UTC
Tested in 4.0.1 RC1 (2013-02-22).  

The LET code is still not executed, even when the LET is explicit.  The SET code is executed instead, which is incorrect and will, I assume, cause many class modules to fail.
Comment 7 Rainer Bielefeld Retired 2013-02-25 06:24:54 UTC
I did some tests where wrong Result "0" after  macro execution started:

Already  [Reproducible] with  unzipped  installation of  "LOdev  4.0.0.0.alpha1+   -  ENGLISH UI / German Locale  [Build ID: af60316514f3ae3d4c475819bf86f2af837171e)]"  {tinderbox: Win-x86@6, pull time 2012-11-23 22:10:31} on German WIN7 Home Premium (64bit) with own separate User Profile 

Still worked fine with  Server-installation of Master " 3.7.0.0.alpha0+  – ENGLISH UI [Build ID: f2e622]" {tinderbox: Win-x86@16, pull time 2012-10-06 09:31:39} on German WIN7 Home Premium (64bit) UserInstallation=$SYSUSERCONFIG/LOdev/3

May be we can narrow that down with Bibisect?
Comment 8 Rainer Bielefeld Retired 2013-03-13 12:44:13 UTC
@Noel:
Can you help here?
Comment 9 Noel Power 2013-03-13 14:13:22 UTC
(In reply to comment #8)
> @Noel:
> Can you help here?

(In reply to comment #8)
> @Noel:
> Can you help here?

sure, I'll take the bug, weird though because it is working on master
Comment 10 Noel Power 2013-03-13 14:34:58 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > @Noel:
> > Can you help here?
> 
> sure, I'll take the bug, weird though because it is working on master

not weird, just wrong, must have had a 4.0 instance running, doesn't work on master :-)
Comment 11 Commit Notification 2013-03-13 14:40:51 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9dcfc56c7cd76de237f45cf46448c14cfbb2f45c

Fix Set/Let mixup ( from String -> OUString rework ) fdo#60752



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2013-03-13 15:10:58 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ee84eaa33aef7b7523ce949ad3e2ccf9bc467c6d&h=libreoffice-4-0

Fix Set/Let mixup ( from String -> OUString rework ) fdo#60752


It will be available in LibreOffice 4.0.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2013-03-13 15:46:23 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "libreoffice-4-0-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=08a9069bc85daf9f628688346003087056308493&h=libreoffice-4-0-2

Fix Set/Let mixup ( from String -> OUString rework ) fdo#60752


It will be available already in LibreOffice 4.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 14 tim 2013-03-15 15:49:55 UTC
Fix doesn't appear to be in 4.0.2_1 (RC1) as yet.  Is that correct?
Comment 15 tim 2013-03-29 12:53:19 UTC
Tested in 4.0.2 RC2.  Works fine.  

Thanks to all.