Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliSense does not understand lambda parameter type, when overloaded with defaultValue #11053

Closed
Suchiman opened this issue May 4, 2016 · 4 comments

Comments

@Suchiman
Copy link
Contributor

Suchiman commented May 4, 2016

Version Used: VS2015.2

Steps to Reproduce:

using System;
using System.Collections.Generic;

public static class Program
{
    public static void Main()
    {
        var parameter = new List<string>();
        var result = parameter.FirstOrDefault(x => x$);
    }
}

public static class Enumerable
{
    public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, TSource defaultValue)
    {
        return default(TSource);
    }

    public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, TSource defaultValue)
    {
        return default(TSource);
    }
}
  1. Set cursor to $
  2. Type . and get no IntelliSense

Expected Behavior:
IntelliSense picks the correct overload and suggests that the type of x is string, providing member completion.

Actual Behavior:
IntelliSense showing (Parameter) ? x
If you change the FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, TSource defaultValue) overload to FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate), then it works as expected

@Pilchie Pilchie added this to the 1.3 milestone May 6, 2016
@Pilchie
Copy link
Member

Pilchie commented May 6, 2016

I suspect that this is an issue with SemanticModel.LookupSymbols, but can you double-check and move to compiler if so?

@rchande
Copy link
Contributor

rchande commented May 19, 2016

@cston I debugged this and it looks like GetSymbolInfo/GetTypeInfo on the reference to x both return nothing after you type ..

The relevant IDE code is here

@rchande
Copy link
Contributor

rchande commented May 19, 2016

Moving to compiler.

@rchande rchande removed their assignment May 19, 2016
@cston cston self-assigned this May 20, 2016
@jaredpar
Copy link
Member

@Pilchie, @DustinCampbell is this just another instance of #11619?

@gafter gafter assigned gafter and unassigned cston Jun 1, 2016
@gafter gafter modified the milestones: 2.0 (RC), 1.3 Jun 1, 2016
gafter added a commit to gafter/roslyn that referenced this issue Jun 2, 2016
because there are arguments missing, to force lambda binding
for error recovery.
Fixes dotnet#11053, dotnet#11358
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants