Issue 11678 - Bug with using Optional Parameters and IsMissing in Basic Macros
Summary: Bug with using Optional Parameters and IsMissing in Basic Macros
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: General
Classification: Code
Component: scripting (show other issues)
Version: 643C
Hardware: PC Windows 2000
: P3 Trivial (vote)
Target Milestone: ---
Assignee: ab
QA Contact: issues@framework
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-20 13:23 UTC by faltrion
Modified: 2003-03-12 14:33 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description faltrion 2003-02-20 13:23:52 UTC
When using the Subroutine/function below, I get results that I should not get
it looks like there is some sort of bug concerning the usage of Optional values
in calling Subs/Functions when I declare the type of the Optional value (Only
tested String and Long, but I guess it is the same for the others)

Here is my test code, a better description follows below.

Sub test()
    MsgBox "a-" & testMissing()
    MsgBox "b-" & testMissing(1)
    MsgBox "c-" & testMissing(1,2)
    MsgBox "d-" & testMissing(1,2,3)
    MsgBox "e-" & testMissing(1,,)
    MsgBox "f-" & testMissing(1,2,)
    MsgBox "g-" & testMissing(1,,3)
    MsgBox "h-" & testMissing(,2,)
    MsgBox "i-" & testMissing(,2,3)
    MsgBox "j-" & testMissing(,,3)
    MsgBox "k-" & testMissing(,,)
End Sub

Function testMissing(Optional s1 as Long, Optional s2 as Long, Optional s3 as Long)
    Dim sTest As String
    If( IsMissing(s1)) Then
        sTest = "[<MISSING>]"
    Else
        sTest = "[" & s1 & "]"
    End If
    If( IsMissing(s2)) Then
        sTest = sTest & "[<MISSING>]"
    Else
        sTest = sTest & "[" & s2 & "]"
    End If

    If( IsMissing(s3)) Then
        sTest = sTest & "[<MISSING>]"
    Else
        sTest = sTest & "[" & s3 & "]"
    End If
    testMissing = sTest
End Function


what I believed I would get is the following
a-[<MISSING>][<MISSING>][<MISSING>]
b-[1][<MISSING>][<MISSING>]
c-[1][2][<MISSING>]
d-[1][2][3]
e-[1][<MISSING>][<MISSING>]
f-[1][2][<MISSING>]
g-[1][<MISSING>][3]
h-[<MISSING>][2][<MISSING>]
i-[<MISSING>][2][3]
j-[<MISSING>][<MISSING>][3]
k-[<MISSING>][<MISSING>][<MISSING>]

and to begin with it worked, the a,b,c,d,f worked as I had expected it, but  the
rest, they produced something strange..
e-[1][448][<MISSING>]
g-[1][448][3]
h-[448][2][<MISSING>]
i-[448][2][3]
j-[448][448][3]
k-[448][448][<MISSING>]

I have also tried this with Strings instead of Long as parameter type, but then
I did not get the 448 but I did get a string looking like this
"Error "  with a square character at the end.


when removing the as Long/String in the function declaration

Function testMissing(Optional s1, Optional s2, Optional s3)

Everything works as expected.

considering that when I do not send in any parameter at all compared to when I
send in "empty
    MsgBox "a-" & testMissing()
    MsgBox "k-" & testMissing(,,)

these should perform the same for me, and I do get "Missing" in the first case,
so it is possible that a Long/String can be missing
Comment 1 Unknown 2003-02-25 13:43:18 UTC
Misfiled, the framewwork/ scripting deals with the langauge
independent scripting framework, not Star Basic:

This StarBasic issue should be filed under:
Component: Scripting
SubComponent: Code
Comment 2 Unknown 2003-02-25 13:45:47 UTC
Status changed to INVALID - refer to comment below on mis-filing
Comment 3 michael.bemmer 2003-03-12 14:14:00 UTC
As mentioned on the qa dev list on March 5th I will close all resolved
<wontfix/duplicate/worksforme/invalid> issues. Please see this posting for
details. First step in IssueZilla is unfortunately to set them to verified.
Comment 4 michael.bemmer 2003-03-12 14:33:05 UTC
As mentioned on the qa dev list on March 5th I will close all resolved
<wontfix/duplicate/worksforme/invalid> issues. Please see this posting for details.