Skip to content

🐛 [BUG] - Graph nodes contain duplicate slashes in paths (// instead of /) #405

@PFAhard

Description

@PFAhard

Description

Contracts compilation on windows was failing on compilation_unit.py#L62

Occurs when running VS code extension on c4 contest

I'm not very happy with the use (and existence) of Python, so I don't want to investigate this in detail.
But a quick debug shows that some nodes in self.__unit_graph.nodes contain // instead of /.
The same is true for the function parameter source_unit_name in some calls.

Quick fixed in local fork this way:

    def source_unit_name_to_path(self, source_unit_name: str) -> Path:
        nx.relabel_nodes(self.__unit_graph, {n: n.replace("//", "/") for n in self.__unit_graph if "//" in n}, copy=False)
        return self.__unit_graph.nodes[source_unit_name.replace("//", "/")]["path"]

Works OK.
But proper fix would be great.

Reproduction steps

Clone the linked repo and try using the VS Code extension. I'm not sure if this will always reproduce the issue — it may require specific conditions — but the lack of path normalization is evident.

Reproduction URL

No response

Screenshots

Logs

OS

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions