Bug 60970 - CS0266 when compiling enum assignment with classes defined via Mono.CSharp.Evaluator
Summary: CS0266 when compiling enum assignment with classes defined via Mono.CSharp.Ev...
Status: NEW
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: master
Hardware: PC All
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2017-12-04 15:44 UTC by Bartek Bok
Modified: 2017-12-11 16:53 UTC (History)
2 users (show)

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

Test case (2.80 KB, text/plain)
2017-12-04 15:44 UTC, Bartek Bok

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 for Bug 60970 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Bartek Bok 2017-12-04 15:44:58 UTC
Created attachment 25900 [details]
Test case

Compiling simple statement like `TestEnum v = TestEnum.B` with Mono.CSharp.Evaluator fails with message like:

test:(15,71): error CS0266: Cannot implicitly convert type `int' to `N1.N2.TestEnum'. An explicit conversion exists (are you missing a cast?)

when `TestEnum` is type defined in separate `Evaluator` instance and added via `.ImportTypes()`.

Using enums defined in same Evaluator instance as assignment or outside any evaluator compiles without errors (see attached example).