xsharp.eu • Error XS0173 Type of IIF expression cannot be determined
Page 1 of 1

Error XS0173 Type of IIF expression cannot be determined

Posted: Tue Aug 16, 2022 8:40 pm
by ic2
Consider this line:

Code: Select all

cAttachPath := Iif(Self:lEWMvalid, Self:oMailSends:oEWM:cSaveAttachmentPath, "")


This gives:

Error XS0173 Type of IIF expression cannot be determined because there is no implicit conversion between '?' and 'string'

What's actually happening here is that oEWM was not declared (outcommented from converted code) within the class assigned to variable Self:oMailSends.

I can imagine some logic in the error message but it would be a lot clearer if the compiler could directly tell that it can't find oEWM. Maybe warning XS9073? The tooltip says Undeclared.

Dick

Error XS0173 Type of IIF expression cannot be determined

Posted: Tue Aug 16, 2022 11:19 pm
by Chris
Hi Dick,

What is oMailSends declrared as?

Error XS0173 Type of IIF expression cannot be determined

Posted: Wed Aug 17, 2022 10:17 am
by ic2
Hello Chris,

This is a class which opens emails.dbf, reads the account data from a setting file and more using a set of protected variables.

In the VO version we have the class variables include oEWM which is a reference to a splitwindow in which we show the mails. This is (yet) not defined in X#. SO I just wondered why the compiler doesn't directly tell me that oEWM is unknown within this line of code.

Dick

Error XS0173 Type of IIF expression cannot be determined

Posted: Wed Aug 17, 2022 1:56 pm
by Chris
Hi Dick,

I meant how is the iVar "oMailSends" itself defined? What is the exact line of code where it is declared?

Error XS0173 Type of IIF expression cannot be determined

Posted: Wed Aug 17, 2022 2:10 pm
by ic2
Hello Chris,

Like this:

Code: Select all

oEmailForm := NewEmail{Self, oCKEmail, cFromAccount, cSendType, lEverything, cRecordList}
oEmailForm:Show()

.......

Public Constructor(oCaller As MailSends, oInEmail As Chilkat.Email, cFromAccount As String, cSendType As String, lEverything As Logic, cRecordList As String) Strict Class NewMail
InitializeComponent()
Self:oMailSends := oCaller

Dick

Error XS0173 Type of IIF expression cannot be determined

Posted: Wed Aug 17, 2022 2:34 pm
by robert
Dick,
Chris wants to know how the instance variable oMailSend is defined.
Like:

Code: Select all

EXPORT oMailSends as MailSends
or

Code: Select all

EXPORT oMailSends as OBJECT
If oMailSends is declared AS OBJECT then the compiler does know that oEWM is a commented out property of the MailSends class.

Robert

Error XS0173 Type of IIF expression cannot be determined

Posted: Wed Aug 17, 2022 2:55 pm
by ic2
Hello Robert,

Ah, of course. Like this:

PROTECTED oMailSends AS MailSends

I would say the compiler should then see & tell that oEWM is not defined in MailSends.

It's not a big deal but that error would have been a lot clearer.

Dick