Skip to content

Accessing parent class fields (XBase++) #1836

@DenGhostYY

Description

@DenGhostYY

Describe the bug
Hello. When attempting to access class fields of a parent class, a runtime error occurs. You previously fixed a similar bug for methods.

To Reproduce

procedure main()
    Child():setter(1)
    ? Child():getter()

    Child():exportedField := 2
    ? Child():exportedField
    wait
return


class Child from Parent
endclass


class Parent
exported:
    inline class method initClass()
        ::classField := 0
        ::exportedField := 0
    return

    inline class method getter()
    return ::classField

    inline class method setter(n)
        ::classField := n
    return

    class var exportedField

hidden:
    class var classField
endclass

Expected behavior (XBase++ exe)
Output

1
2

Actual behavior (X# exe)
Output

1
Unhandled exception: System.InvalidOperationException: The sequence contains no elements
   в System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   в XSharp.XPP.ClassObject.NoIvarPut(String cName, __Usual uValue)
   в XSharp.RT.OOPHelpers.IVarPut(Object oObject, String cIVar, Object oValue, Boolean lSelf)
   в XSharp.RT.Functions.IVarPut(Object oObject, String symInstanceVar, __Usual uValue)
   в main.Exe.Functions.main(__Usual[] Xs$Args)
   в main.Exe.Functions.Start(String[] Xs$Args)

Additional context
X# Compiler version 2.24.0.1 (Public)
-dialect:xBase++
-codepage:866
-lb -enforceself -memvar -xpp1 -vo1 -vo3 -vo4 -vo5 -vo9 -vo10 -vo12 -vo13 -vo14 -vo15 -vo16 -vo17
-reference:XSharp.Core.dll
-reference:XSharp.RT.dll
-reference:XSharp.XPP.dll

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions