Bug 150422

Summary: You can "call" a scalar variable as function; an error should be shown instead
Product: LibreOffice Reporter: Mike Kaganski <mikekaganski>
Component: BASICAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: himajin100000, sokol
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=102381
Whiteboard:
Crash report or crash signature: Regression By:

Description Mike Kaganski 2022-08-15 12:48:43 UTC
Consider the code:

Sub TestCallingVariable
  Dim Month
  MsgBox Month(Now)
End Sub

Running this gives an empty message box.

This is a simplified user error case, where the built-in Month [1] was redefined locally as a variable. The problem here is that there is no error suggesting that Month(Now) makes no sense: Month local variable is neither a function, nor an array.

[1] https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03030104.html?DbPAR=BASIC
Comment 1 Vladimir Sokolinskiy 2022-08-15 13:07:28 UTC
Hello Mike! It seems to me that this is part of the overall picture: Basic ignores "extra parameters".

Option Explicit
Sub Test1
  Dim a
  Msgbox a(1)              ' Empty string
  Msgbox abs(1, 2, 3, 4)   ' 1
End Sub