Skip to content

Issues with using Psz2String() on iVars #775

@cpyrgas

Description

@cpyrgas

The following code reports an error for the inline assignment of an Ivar PSZ with String2Psz(). The error is correct, but the message is not descriptive of the problem: error XS0103: The name 'Xs$PszList' does not exist in the current context

Also the code assigns String2Psz() on a iVar from various entities, but the contents of this iVar are no longer valid once the entity exits. Would be very nice if the compiler issued warnings on those assignments.

// error XS0103: The name 'Xs$PszList' does not exist in the current context
FUNCTION Start() AS VOID
	LOCAL o AS TestClass
	o := TestClass{}
	? o:p1
	? o:p2
	
	DoTest(o)
	? o:p1
RETURN

PROCEDURE DoTest(o AS TestClass)
	o:p1 := String2Psz("newpSZ") // should be  a warning here

CLASS TestClass
	EXPORT p1 AS PSZ
	EXPORT p2 := String2Psz("psz1") AS PSZ
	CONSTRUCTOR()
		p1 := String2Psz("psz2") // should be  a warning here
		? SELF:p1
		? SELF:p2
	RETURN
END CLASS

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions