Return value - compile error

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

Return value - compile error

Post 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


Attachments

[The extension viaef has been deactivated and can no longer be displayed.]

FFF
Posts: 1522
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Return value - compile error

Post by FFF »

What happens when you remove the self after the return?
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Return value - compile error

Post 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
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

Return value - compile error

Post by Karl-Heinz »

The second CaSe SensitiVe trap in the last 2 weeks - I'm shocked. :woohoo:
Are there even more buried somewhere ? :-)
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Return value - compile error

Post by Chris »

Possibly....:)

(but not any known ones at least)
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Post Reply