https://bugs.documentfoundation.org/show_bug.cgi?id=159455

Rafael Lima <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |[email protected]

--- Comment #1 from Rafael Lima <[email protected]> ---
This is definitely a bug in the Basic interpreter, because the results depend
on the position of the optional argument.

Consider the two following scenarios where I add a new argument (newArg) after
and before "B" in your example:

SCENARIO 1 (new optional argument "newArg" after argument B)

Sub Bug_Default_Ignored ()
        Bug_Default_Ignored_Sub (B := True)
End Sub

Sub Bug_Default_Ignored_Sub _
( Optional A as Boolean = True _
, Optional B as Boolean = False _
, Optional newArg as Integer = 10 _
)
        MsgBox ("A = " + A + ",  B = " + B + ", newArg = " + newArg)
End Sub

Running Bug_Default_Ignored will print "A = False,  B = True, newArg = 10"
(notice that newArg = 10 which is correct)

SCENARIO 2 (new optional argument "newArg" before argument B)

Sub Bug_Default_Ignored ()
        Bug_Default_Ignored_Sub (B := True)
End Sub

Sub Bug_Default_Ignored_Sub _
( Optional newArg as Integer = 10 _
, Optional A as Boolean = True _
, Optional B as Boolean = False _
)
        MsgBox ("A = " + A + ",  B = " + B + " newArg = " + newArg)
End Sub

Running Bug_Default_Ignored will print "A = False,  B = True, newArg = 0"
(notice that newArg = 0 now).

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to