Skip to content

Declaring a field with the same name as a type #428

Description

@imnaseer

The compiler generates a truncated file if the code does a type check on a type and there is a field with the same name as the type.

The following snippet will reproduce the internal crash:

public class Class1
{
    public BaseClass BaseClass = new BaseClass();

    public void Foo()
    {
        BaseClass obj = new BaseClass();
        bool isBaseClass;
        if (obj is BaseClass)
        {
            isBaseClass = true;
        }
       else
       {
           isBaseClass = false;
       }
    }
}

Changing the field named BaseClass to another name and/or removing the "is" type check will lead to correct js code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions