lonely-lockley / archinsight

Simplicity in Code, Power in Design
https://archinsight.org
GNU Affero General Public License v3.0
51 stars 5 forks source link

Fix an issue with import and declaration checks #79

Closed lonely-lockley closed 4 months ago

lonely-lockley commented 6 months ago

Fix an issue that imported element with the name A does not trigger "already declared" error while linking

jwhitt3r commented 6 months ago

Hay, would you be available to give some more detail on this issue, I would like to contribute if possible. What are the steps to reproduce, what is the location believed to have this issue so I can start looking.

lonely-lockley commented 6 months ago

Hi! Sure: the issue is in Translator service. To reproduce you can go to https://archinsight.org/playground and create two new files. This is the code for the first one:

context a
system a
    name = original A

This is for the second:

context b
import system a from context a
system b
    name = B
    links:
        -> a
system a
    name = duplicate A

You will see, that the diagram is rendered, but it should not, because system a declared in the second file duplicates imported system a. Translator should return error message about duplicated identifier a. The issue is somewhere around this method

jwhitt3r commented 6 months ago

Wicked, I shall have a look later today.

Thank you for the detailed response 👍

lonely-lockley commented 4 months ago

This fix is in production now. Congrats!

jwhitt3r commented 4 months ago

That's awesome thank you!