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

Same name systems in different namespaces cause linerization error #3399

Open
officialnico opened this issue Dec 20, 2024 · 0 comments
Open

Comments

@officialnico
Copy link

officialnico commented Dec 20, 2024

When we have the same system names across two different namespaces it causes a clash in the IWorld interface by importing twice

Systems

Screenshot 2024-12-20 at 12 36 15 PM

Code generated world interface (inherits the systems twice)

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24;

/* Autogenerated file. Do not edit manually. */

import { IBaseWorld } from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol";
import { IIncrementMoreSystem } from "./IIncrementMoreSystem.sol";
import { IIncrementSystem } from "./IIncrementSystem.sol";

/**
 * @title IWorld
 * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
 * @notice This interface integrates all systems and associated function selectors
 * that are dynamically registered in the World during deployment.
 * @dev This is an autogenerated file; do not edit manually.
 */
interface IWorld is IBaseWorld, IIncrementMoreSystem, IIncrementSystem, IIncrementMoreSystem, IIncrementSystem {}

Error

Error (5005): Linearization of inheritance graph impossible
--> src/codegen/world/IWorld.sol:17:1:
|
17 | interface IWorld is IBaseWorld, IIncrementMoreSystem, IIncrementSystem, IIncrementMoreSystem, IIncrementSystem {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Potential fix:

I suggest using the namespace naming convention as the interface name and file name to avoid clashes

i.e

namespaceA__fightSystem

namespaceB__fightSystem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant