Skip to content

Object creation new X(...) has no constructor occurrence, only a type occurrence #135

Open

Description

@stacknoise

Version: scip-dotnet 0.2.16+fadd98aebb1ede2c55801636360c002679b54112, .NET SDK 8.0.134, Linux, project targeting net8.0.

For an object creation expression the index has an occurrence of the type, but none of the constructor that the compiler binds. Constructor occurrences do exist elsewhere (for attributes, for example [MeansImplicitUse(...)] gets MeansImplicitUseAttribute#`.ctor`(+2).).

Reproduction, with the project above:

public class Made
{
    private Made() { }
    public Made(int x) { }
    public static Made Make() => new Made();
    public static Made Make2() => new Made(1);
}

Observed: at new Made() and at new Made(1) only the occurrence Made# is written (on the type name), for the private and for the public, overloaded constructor alike. Expected: an occurrence of Made#`.ctor`(). and Made#`.ctor`(+1). respectively, so that uses of a constructor can be found.

Suggested fix

Write a constructor occurrence for object creation expressions (including target-typed new(...)).

Activity

  1. linear-code commented on Nov 16, 2026

    @linear-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions