XSharpPublic icon indicating copy to clipboard operation
XSharpPublic copied to clipboard

Incorrect Compiler incorrectly resolves static member of another type to SELF property when /allowdot is enabled

Open cpyrgas opened this issue 1 year ago • 0 comments

In the following code, in X# build 2.20, the compiler no longer uses the enum, but the internal property Test and reports

error XS1061: 'int' does not contain a definition for 'Val1' and no accessible extension method 'Val1' accepting a first argument of type 'int' could be found

In previous builds, this was compiling without errors.

Problem happens when /allowdot+ is enabled. Same issue exists for STATIC members.

// /allowdot+
USING System.Reflection

CLASS Test1
   PROPERTY Test AS INT AUTO GET SET
   PROPERTY BindingFlags AS INT AUTO GET SET
   PROPERTY TestStatic AS INT AUTO GET SET

	METHOD TestMethod() AS VOID
		LOCAL e AS OBJECT
		? SELF:Test > Test.Val1 // error XS1558
		e := BindingFlags.CreateInstance // error XS1558
		? TestStatic.StaticExport // error XS1558
END CLASS


PUBLIC ENUM Test
	MEMBER Val1
	MEMBER Val2
	MEMBER Val3
END ENUM

STATIC CLASS TestStatic
	STATIC EXPORT StaticExport AS INT
END CLASS

cpyrgas avatar May 07 '24 22:05 cpyrgas