Bug 10728 - Auto-Fix regarding control flow: "Convert to correct type"
Summary: Auto-Fix regarding control flow: "Convert to correct type"
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: 4.0
Hardware: PC Linux
: Normal enhancement
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2013-02-27 07:59 UTC by Ciprian Khlud
Modified: 2013-04-16 23:58 UTC (History)
1 user (show)

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 Developer Community or GitHub 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:

Description Ciprian Khlud 2013-02-27 07:59:08 UTC
Reference to bug #10717 comment 1
Add an Auto-Fix that simplify blocks of code:

Steps to reproduce:
Write a code that matches this pattern:
 "double c = 3.5;
  float fc $= c;"

Expected result:
 "double c = 3.5;
  float fc = (float)c;"

Other similar case:
enum MyEnum{Field0, Field1}
var enumValue = MyEnum.Field1;
int intEnum $= enumValue;
When applied, becomes:
int intEnum $= (int)enumValue;

Typical conversions are:
- from different lengths of ints (byte, uint8, long, short, uint64, etc.)
- double to float
- enums to int and int to enum
Comment 1 Ciprian Khlud 2013-04-16 16:51:05 UTC
I think that can be closed with this commit: https://github.com/icsharpcode/NRefactory/pull/165
Comment 2 Mike Krüger 2013-04-16 23:58:03 UTC
Thanks - closing