Bug 3453 - [New Resolver] "Resolve" doesn't show up from time
Summary: [New Resolver] "Resolve" doesn't show up from time
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal major
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-02-14 14:56 UTC by Chris Hardy [MSFT]
Modified: 2012-03-16 08:13 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Chris Hardy [MSFT] 2012-02-14 14:56:55 UTC
Difficult to work out when you can "resolve" a type, see video: http://screencast.com/t/zY4bTHBk7

This generally happens when trying to resolve UIUtils with the following code already typed out;

public string GetBlockTimeString() {
   TimeZone.Default = UIUtils
   return DateUtils.formatDateTime(getContext(), mStartTime, TIME_STRING_FLAGS);
}
Comment 2 Miguel de Icaza [MSFT] 2012-02-14 15:48:20 UTC
Hey guys,

Question: in the video, I did not see the invalid AST since the code for "return" was commended out, so what I saw repeatedly was equivalent to this:

class Test
{
    public string GetBlockTimeString()
    {
       TimeZone.Default = UIUtils
    }
}

Why could we not auto-complete in this case?

Now, speaking about mcs: what is the request?   I did not understand from the previous comment what is it that you would like mcs to do.
Comment 3 Mike Krüger 2012-02-15 01:29:07 UTC
It is not about auto-complete. That case you have works - see 0:13 - "resolve" shows up. But the others don't.

The request is: can mcs do the cases above, or should I try to work - around it somehow ?
Comment 4 Miguel de Icaza [MSFT] 2012-02-15 14:36:15 UTC
Hello Mike,

I am sorry, but I still do not understand what the request is.

At 0:13 I see that the "resolve" shows up, now where is the problem that you would like MCS to deal with?
Comment 5 Mike Krüger 2012-02-15 16:00:24 UTC
Ok, I repeat - see the video there are cases where resolve doesn't show up, these cases are:

Case1:
------------------
class Test
{
    public string GetBlockTimeString()
    {
       TimeZone.Default = UIUtils
       return DateUtils.formatDateTime(getContext(), mStartTime,
TIME_STRING_FLAGS);
    }
}

Here the return statement is inserted, but the assign is missing.

------------------
Case1 - 2nd case:

class Test
{
    public string GetBlockTimeString()
    {
       UIUtils
       return DateUtils.formatDateTime(getContext(), mStartTime,
TIME_STRING_FLAGS);
    }
}

Here a complete wrong statement is generated (yield return ?).

------------------
Case3:
class Test
{
    public string GetBlockTimeString()
    {
       UIUtils.
    }
}

-----------------------------------------------------------------------------

Can mcs produce an AST for these? Esp. nice would be a correct AST up to the error. Atm it produces a wrong AST (case 2) or doesn't produce a statement (case 1/3) for the incomplete one.

It's just a tiny request - if that's too problematic for these cases I can do something about it, there are some aproaches I could try to "fix" this.
For example I could do a work around & reparse the method up to the caret line, that may work in more cases (but not in the case #3), or I just take the fully qualified identifier under the caret and try to resolve that or something.

The use case "resolve" menu is different than that of the code completion - that's why the request here is a different. 

However we could say we don't support "resolve" for cases that are syntactically incorrect, but I think that most people are using it while the syntax is incomplete.
Comment 6 Miguel de Icaza [MSFT] 2012-02-16 12:20:08 UTC
I think mcs can handle all of those.

I am a bit busy until next week, but will look at them
Comment 7 Chris Hardy [MSFT] 2012-03-06 11:43:13 UTC
Here's a repo project as a Mono for Android project: http://dl.dropbox.com/u/90453/ResolveIssueTestCase.zip

Same UIUtils class name.
Comment 8 Mike Krüger 2012-03-16 08:13:23 UTC
Fixed that one on IDE level.