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

Properly implement type inference for C# member access expressions. #12110

Merged
merged 11 commits into from
Jun 21, 2016
Prev Previous commit
Next Next commit
Fix test.
  • Loading branch information
CyrusNajmabadi committed Jun 21, 2016
commit e11beed3eff074a49a14b607833f6561dd3a1577
Original file line number Diff line number Diff line change
Expand Up @@ -2766,7 +2766,15 @@ static void Main ( string [ ] args ) {
bool x = await [|Foo|] ( ) . ConfigureAwait ( false ) ;
}
}",
@"using System ; using System . Collections . Generic ; using System . Linq ; using System . Threading . Tasks ; class Program { static void Main ( string [ ] args ) { bool x = await Foo ( ) . ConfigureAwait ( false ) ; } private static Task < bool > Foo ( ) { throw new NotImplementedException ( ) ; } } ");
@"using System ;
using System . Collections . Generic ;
using System . Linq ;
using System . Threading . Tasks ;
class Program {
static void Main ( string [ ] args ) {
bool x = await Foo ( ) . ConfigureAwait ( false ) ;
}
private static Task < bool > Foo ( ) { throw new NotImplementedException ( ) ; } } ");
}

[WorkItem(643, "https://github.com/dotnet/roslyn/issues/643")]
Expand All @@ -2781,7 +2789,12 @@ static async void T ( ) {
bool x = await [|M|] ( ) . ContinueWith ( a => { return true ; } ) . ContinueWith ( a => { return false ; } ) ;
}
} ",
@"using System ; using System . Threading . Tasks ; class C { static async void T ( ) { bool x = await M ( ) . ContinueWith ( a => { return true ; } ) . ContinueWith ( a => { return false ; } ) ; } private static object M ( ) { throw new NotImplementedException ( ) ; } } ");
@"using System ;
using System . Threading . Tasks ;
class C {
static async void T ( ) {
bool x = await M ( ) . ContinueWith ( a => { return true ; } ) . ContinueWith ( a => { return false ; } ) ; }
private static Task<object> M ( ) { throw new NotImplementedException ( ) ; } } ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now infers object instead of bool?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as below I guess.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The inference of 'bool' was specious. It basically was saying the equivalent of: i have "bool b = x.y.z", ergo 'x' and 'y' are bool". This simply is not an accurate or appropriate inference to make.

}

[WorkItem(529480, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529480")]
Expand Down