Bug 150422 - You can "call" a scalar variable as function; an error should be shown instead
Summary: You can "call" a scalar variable as function; an error should be shown instead
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-15 12:48 UTC by Mike Kaganski
Modified: 2022-09-15 12:54 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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