xsharp.eu • Return value - compile error
Page 1 of 1

Return value - compile error

Posted: Fri Dec 21, 2018 5:15 pm
by Karl-Heinz
Guys,

i´ve compiled a app with the 2.0.0.8 build and i´m wondering what the compiler is trying to tell me :( :

warning XS9032: This entity type cannot return a value. Return value ignored.
error XS1520: Method must have a return type
Compilation failed (1 error, 1 warning)

i could isolate the problem to a VO Dialogwindow - other VO windows compile as expected. The attached and simplified viaef contains the partial class DlgText. As soon the code in the "DlgText" modul is deactivated i can compile and run the app, otherwise i get the error/warning above.

Honestly, i don´t get it - what is the problem ?

regards
Karl-Heinz

// dlgText_vo generated code

Code: Select all


PARTIAL CLASS DlgText INHERIT DIALOGWINDOW
PROTECT oDCsleText AS SINGLELINEEDIT
PROTECT oCCPshOk AS PUSHBUTTON

// User code starts here (DO NOT remove this line)  ##USER##
CONSTRUCTOR(oParent,uExtra)   //  -----------  Error ????

	SELF:PreInit(oParent,uExtra)

	SUPER(oParent , ResourceID{"DlgText" , _GetInst()} , TRUE)

	SELF:oDCsleText := SINGLELINEEDIT{SELF , ResourceID{ DLGTEXT_SLETEXT  , _GetInst() } }
	SELF:oDCsleText:HyperLabel := HyperLabel{#sleText , NULL_STRING , NULL_STRING , NULL_STRING}

	SELF:oCCPshOk := PUSHBUTTON{SELF , ResourceID{ DLGTEXT_PSHOK  , _GetInst() } }
	SELF:oCCPshOk:HyperLabel := HyperLabel{#PshOk , "Ok" , NULL_STRING , NULL_STRING}

	SELF:Caption := "Dialog Caption"
	SELF:HyperLabel := HyperLabel{#DlgText , "Dialog Caption" , NULL_STRING , NULL_STRING}

	SELF:PostInit(oParent,uExtra)

RETURN SELF // ----------------  Warning  ????

 
END CLASS

STATIC DEFINE DLGTEXT_SLETEXT := 100
STATIC DEFINE DLGTEXT_PSHOK := 101

// dlgText.prg user code

Code: Select all


PARTIAL CLASS DlgTExt

	
METHOD PostInit(oParent,uExtra)
	
	SUPER:PostInit ( oParent , uExtra ) 
	
	oDCSleText:Value := uExtra [ 1 ] 
	
 RETURN SELF
 
 
ACCESS sleText 

	RETURN oDCSleText:Value                 
	

METHOD PshOk() 

	IF ! Empty ( oDCSleText:VALUE ) 
		
		SELF:EndDialog ( IDOK )
		
	ELSE 
		
		oDCSleText:SetFocus() 
		
	ENDIF 
	
	RETURN SELF
	
END CLASS



Return value - compile error

Posted: Fri Dec 21, 2018 5:38 pm
by FFF
What happens when you remove the self after the return?

Return value - compile error

Posted: Fri Dec 21, 2018 5:55 pm
by Chris
Hi Karl-Heinz,

The compiler does not try to tell you anything, this is a bug :). But fortunately there's an easy workaround, just change yout PARTIAL CLASS declarations wo that both have the same casing (currently one is "DlgText" and the other "DlgTExt") and it will work.

Thanks for the report, will log this so this will be fixed for the next release the latest.

About the warning in the constructor(), this is a correct one, constructors in .Net do not return anything, so the RETURN value is being ignored.

Chris

Return value - compile error

Posted: Fri Dec 21, 2018 6:30 pm
by Karl-Heinz
The second CaSe SensitiVe trap in the last 2 weeks - I'm shocked. :woohoo:
Are there even more buried somewhere ? :-)

Return value - compile error

Posted: Fri Dec 21, 2018 9:59 pm
by Chris
Possibly....:)

(but not any known ones at least)