https://bugs.documentfoundation.org/show_bug.cgi?id=151503
Bug ID: 151503 Summary: logical operator semantics on missing (optional) arguments has changed between 7.2 and 7.4 Product: LibreOffice Version: 7.4.1.2 release Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: medium Component: BASIC Assignee: libreoffice-bugs@lists.freedesktop.org Reporter: lio...@mamane.lu Description: Consider the following code: sub tst tstOpt end sub sub tstOpt(optional foo as boolean) if ismissing(foo) or foo then msgbox "yes" else msgbox "no" end if end sub In LibreOffice 7.2, calling sub tst (and thus calling tstOpt without its optional argument) would print "yes". I'm not sure whether a missing parameter was coerced to true by the "or" operator, or if the "or" operator was evaluating its arguments lazily left to right, or both. In LibreOffice 7.4, this gives an error "Argument is not Optional". This breaks user code. Compare with: sub tstOpt2(optional foo as boolean) if foo then msgbox "yes" else msgbox "no" end if end sub Which shows "yes" in both LibO 7.2 and LibO 7.4, showing that the if/then construct does coerce a missing parameter to true. The same happens with "and" and "not" operators. Probably the logical operators and/not/or/... should continue to do the same for backwards compatibility and coherence? Steps to Reproduce: run sub tst Actual Results: error "Argument is not Optional" Expected Results: messagebox showing "Yes" Reproducible: Always User Profile Reset: No Additional Info: Version: 7.4.1.2 / LibreOffice Community Build ID: 3c58a8f3a960df8bc8fd77b461821e42c061c5f0 CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3 Locale: fr-LU (fr_LU.UTF-8); UI: en-GB Calc: threaded -- You are receiving this mail because: You are the assignee for the bug.