FuelLabs / sway

🌴 Empowering everyone to build reliable and efficient smart contracts.

Home Page:https://fuellabs.github.io/sway

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiler panics when duplicate enum declarations exists in library

bitzoic opened this issue · comments

In the following example we have this project structure:

project/
├── src/
|   ├── main.sw
│   └──lib.sw
└── Forc.toml

Our library lib.sw has a definition for MyEnum:

library;

pub enum MyEnum {
    variant1: b256,
    variant2: u64,
}

Our contract redefines MyEnum and imports the library:

contract;

mod lib;

use lib::*;

pub enum MyEnum {
    variant1: b256,
    variant2: u64,
}

This results in the following error:

Screenshot 2024-04-26 at 1 59 54 PM

Tested using forc v0.56.0