Giter VIP home page Giter VIP logo

Comments (1)

Dr-Maxwell avatar Dr-Maxwell commented on August 24, 2024

The Issue:

You're trying to alias an enum variant (X) with a new name (Y) within your main.sw file.
However, the compiler throws an error saying Y is not bound, indicating it doesn't recognize the alias.
Expected Behavior (Option 1):

Ideally, the program should be legal. Using Y(42) should create a value of type a::Enum::X(42).
Current Behavior (Bug):

Aliasing enum variants seems to be unsupported in this context.
My own take :

Don't Alias Variants:

The simplest solution is to remove the alias line entirely. Instead of:

use a::Enum::X as Y;
Use the original variant directly:

let _ = a::Enum::X(42);
Check Language Support:

It's possible that the language you're using (.sw suggests a custom language) doesn't support aliasing enum variants. Refer to the language documentation to confirm if this feature is available.
Report the Bug:

If aliasing enum variants should be supported, consider reporting this as a bug to the language developers. They can investigate and potentially fix the issue in future versions.

from sway.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.