Bug 133913 - Passing a constant to a Basic function changes variant parameter type to integer
Summary: Passing a constant to a Basic function changes variant parameter type to integer
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.0.0.0.beta1+
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Andreas Heinisch
URL:
Whiteboard: target:7.1.0 target:7.0.0.1
Keywords: bibisectNotNeeded, regression
Depends on:
Blocks: Macro-StarBasic
  Show dependency treegraph
 
Reported: 2020-06-11 20:45 UTC by Eltomito
Modified: 2020-06-21 21:09 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
A test case for broken parameter-type inference (17.18 KB, application/vnd.oasis.opendocument.text)
2020-06-11 20:45 UTC, Eltomito
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eltomito 2020-06-11 20:45:15 UTC
Created attachment 161901 [details]
A test case for broken parameter-type inference

When a Basic function has a parameter without a specified type, its type is automatically set to variant. However, passing an integer constant as the value of such parameter makes its type integer rather than variant/integer.

This is a change in LO 7.0 beta1 compared to LO 6.4 and I'm pretty sure its a bug.
I'm reporting it, because it actually broke some macros I use in production.

A document with a test-case macro is attached.

This bug may be related to https://bugs.documentfoundation.org/show_bug.cgi?id=132563 but I don't think it's the exact same thing.
Comment 1 Oliver Brinzing 2020-06-13 12:58:59 UTC
(In reply to Eltomito from comment #0)
> This is a change in LO 7.0 beta1 compared to LO 6.4 and I'm pretty sure its
> a bug.

confirming, macro will fail with:

Version: 7.1.0.0.alpha0+ (x64)
Build ID: 59939d2490726336546c7ad05082d23031074e12
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: threaded

but works with:

Version: 6.4.4.2 (x64)
Build-ID: 3d775be2011f3886db32dfd395a6a6d1ca2630ff
CPU-Threads: 4; BS: Windows 10.0 Build 18363; UI-Render: Standard; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc:
Comment 2 Andreas Heinisch 2020-06-15 14:49:17 UTC
I checked the issue and it should not be related to https://bugs.documentfoundation.org/show_bug.cgi?id=132563 but I think it has to do with https://bugs.documentfoundation.org/show_bug.cgi?id=36737.
Comment 3 Andreas Heinisch 2020-06-15 15:15:37 UTC
After some investigations I found the culprit: https://bugs.documentfoundation.org/show_bug.cgi?id=131296
Comment 4 Commit Notification 2020-06-16 21:00:14 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0f6e012057bf0d1cc339154e8af6586d9615a37f

tdf#133913 - create variable with Variant/Type in StepLOADNC

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2020-06-17 10:15:47 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/b62d73ccb04da2c4cf7f68a23742d0670ef7eb90

tdf#133913 - create variable with Variant/Type in StepLOADNC

It will be available in 7.0.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Eltomito 2020-06-18 23:28:51 UTC
I can confirm it's fixed in
Version: 7.1.0.0.alpha0+
Build ID: a3c8ea5e644ca2fc04de9f01ba9f8ace47f520f0
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2020-06-17_02:21:20
Calc: threaded