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

[Bug] Enum, circular dependency and comptime failure #2100

Open
kallisto56 opened this issue Jan 22, 2025 · 0 comments
Open

[Bug] Enum, circular dependency and comptime failure #2100

kallisto56 opened this issue Jan 22, 2025 · 0 comments

Comments

@kallisto56
Copy link
Contributor

Hi there,

On latest nightly (b4cfc11) code below produces 2 errors:

  • Circular dependency;
  • Unable to comptime;

I've attached a small project for convenience, that can be used to reproduce this behaviour.
Attachment: bug.2100.zip

namespace bug2100;

using System;

class Program
{
	static void Main () { }
}

enum Facings
{
	case Right = 1;
	case Left = -1;

	// Removing this gets rid of the errors, but...
	static public implicit operator Facings (int i)
		=> (i < 0) ? .Left : .Right;
}

Circular dependency:

ERROR: Circular data reference detected between the following fields:
  'bug2100.Facings.Left' at line 13:7 in r:\bug.2100\src\Program.bf
 case Left = -1;
      ^^^^^^^^^

Unable to comptime:

ERROR: Unable to comptime bug2100.Facings.operator bug2100.Facings(int i) at line 12:15 in r:\bug.2100\src\Program.bf
 case Right = 1;
              ^
  > Comptime method preparation recursion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant