Bug 125627 - Typed reference parameter is treated as value parameter if ANY type conversion is applied. (Variant/Integer to Integer e.g.)
Summary: Typed reference parameter is treated as value parameter if ANY type conversio...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-StarBasic
  Show dependency treegraph
 
Reported: 2019-06-01 20:38 UTC by Wolfgang Jäger
Modified: 2023-12-13 03:14 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Jäger 2019-06-01 20:38:39 UTC
This was reported years ago for OOo/AOO under a different accent.
See https://bz.apache.org/ooo/show_bug.cgi?id=120069 

It may just be another bug demonstrating that a consistent implementation of automatic type conversion is next to impossible.

Examples: 

Sub TestVariant()
x = 77 REM Creates x as a Variant of current type Integer
in_outI(x)
REM Implicitly "converts" Variant/Integer to Integer creating a new variable.
Print x
REM should print 13, prints 77
in_outV(x) REM No implicit conversion
Print x
REM should print 13, prints 13
End Sub

Sub TestByte()
Dim x As Byte
x = 77
in_outI(x)
REM Implicitly converts Byte to Integer creating a new variable.
REM Should throw a type mismatch.
REM Otherwise automatic conversion of the result on return needed.
REM VERY problematic.
Print x
REM should print 13, prints 77
in_outV(x) 
REM Implicitly converts Byte to Integer creating a new variable.
Print x
REM should print 13, prints 13
End Sub

Sub TestInteger()
Dim x As Integer
x = 77
in_outI(x) REM No implicit conversion. 
Print x
REM should print 13, prints 13
End Sub

Sub in_outI(x As Integer)
x = 13
End Sub

Sub in_outV(x)
x=13
End Sub

Sub TestVS()
x = "test"
in_outS(x)
REM Implicitly "converts" Variant/String to String creating a new variable.
Print x
in_outSV(x)
REM No conversion.
Print x
End Sub

Sub in_outS(x As String)
x = "in_out"
End Sub

Sub in_outSV(x As Variant)
x = "in_out"
End Sub

What should be expected and what actually happens is placed in the example as comments.
Comment 1 himajin100000 2019-11-10 05:56:50 UTC
https://opengrok.libreoffice.org/xref/core/basic/source/runtime/runtime.cxx?r=8c0059e1#4054

t : parameter type
p->GetType() : argument type
Comment 2 himajin100000 2019-11-10 06:12:23 UTC
cf.

https://opengrok.libreoffice.org/xref/core/basic/source/sbx/sbxvalue.cxx?r=b0de7a89#266

(I'm not that sure)
Comment 3 Xisco Faulí 2019-12-12 14:10:45 UTC
Reproduced in

Version: 6.5.0.0.alpha0+
Build ID: 775a06361639ffc539fda20d44b9610c98005d9b
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded
Comment 4 QA Administrators 2021-12-12 04:21:05 UTC Comment hidden (obsolete)
Comment 5 Wolfgang Jäger 2021-12-12 11:30:40 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2023-12-13 03:14:03 UTC
Dear Wolfgang Jäger,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug