Description: The following code has a parameter declared with the same name of a variable declared with Dim in the function. The Dim statement resets the variable to its default initialization (e.g. double, variant). If a second Dim statement is added to declare v again then a compiling error is produced. Sub test(v As Double) Dim v As Double v = 1 End Sub I believe the correct behavior should be a compiling error that the variable is already declared in the function parameter list so that it cannot be declared with a Dim statement. This is the same error as if two Dim statements were added to the function. Steps to Reproduce: 1.Enter subroutine described 2.Enable watch on variable v 3.Monitor value in debug mode and note hat no error occurs Actual Results: The variable v is dimensioned replacing the function parameter definition Expected Results: A compiling error should have been produced as BASIC syntax error 'Variable is already defined' Reproducible: Always User Profile Reset: No Additional Info: [Information automatically included from LibreOffice] Locale: en-US Module: BasicIDE [Information guessed from browser] OS: Linux (All) OS is 64bit: yes This has been tested on Win10 LO 6.1.2 and Linux Debian LO 6.1.3. Version: 6.1.3.1 Build ID: 1:6.1.3~rc1-2 CPU threads: 8; OS: Linux 4.9; UI render: default; VCL: gtk3; Locale: en-US (en_US.UTF-8); Calc: group threaded Version: 6.1.1.2 (x64) Build ID: 5d19a1bfa650b796764388cd8b33a5af1f5baa1b CPU threads: 4; OS: Windows 10.0; UI render: default; Locale: en-US (en_US); Calc: group threaded
possible source code pointer(currently just shadowing the variable?) https://opengrok.libreoffice.org/xref/core/basic/source/comp/dim.cxx?r=587ac01f#1247
Fixed in https://git.libreoffice.org/core/+/bcfe36586c6bd07cef3c2ba39abd38bc9b6ab097