Skip to content

"Go to definition" on instantiation of source type navigates to implicit operator of target type when instantiation emits error #77545

@just-ero

Description

@just-ero

Full issue information + repro project:
https://github.com/just-ero/roslyn-issues-repros/tree/main/4.14.0/006_GoToDefinition_ImplicitConversion_ErrorInCtor

Version

Roslyn: 4.14.0-2.25120.5 (882e679)

Steps to Reproduce

  1. Add the following code wherever syntactically applicable:
    record R(int I);
    
    class C
    {
        public C Repro()
        {
            M(new R(1u));
            return new R(1u);
        }
    
        public static void M(C c) { }
        public static implicit operator C(R r) => throw null;
    }
  2. Use "Go to definition" on the two instantiations of R.

Expected Behavior

"Go to definition" should navigate to R.

Actual Behavior

It navigates to the implicit operator on C.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEhelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    No type

    Projects

    Status

    Completed

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions